diff --git a/CONTRIBUTORS b/CONTRIBUTORS index a8342d123..201224633 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -203,6 +203,7 @@ hideo aoyama Ross Brown 🦙 Lukas Sommer +Luca Auer Lukas Sommer Niclas Heinz Omar Kohl diff --git a/qt/aqt/webview.py b/qt/aqt/webview.py index 980e7a989..b5b50ad72 100644 --- a/qt/aqt/webview.py +++ b/qt/aqt/webview.py @@ -659,17 +659,17 @@ html {{ {font} }} page = self.page() assert page is not None - if cb: - - def handler(val: Any) -> None: - if self._shouldIgnoreWebEvent(): - print("ignored late js callback", cb) - return + def handler(val: Any) -> None: + if self._shouldIgnoreWebEvent(): + print("ignored late js callback", cb) + return + if cb: cb(val) - page.runJavaScript(js, handler) - else: - page.runJavaScript(js) + # Without the following, stale frames showing previous or corrupt content get occasionally displayed. (see #3668 for more details) + self.update() + + page.runJavaScript(js, handler) def _queueAction(self, name: str, *args: Any) -> None: self._pendingActions.append((name, args))