From 697b95965863b6777d2e697caf18745469f39b1a Mon Sep 17 00:00:00 2001 From: sawka Date: Tue, 24 Mar 2026 09:09:13 -0700 Subject: [PATCH 1/2] minor, fix double sub in webview giveFocus --- frontend/app/view/webview/webview.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/frontend/app/view/webview/webview.tsx b/frontend/app/view/webview/webview.tsx index 39369e4daf..02b2a8a5c1 100644 --- a/frontend/app/view/webview/webview.tsx +++ b/frontend/app/view/webview/webview.tsx @@ -74,6 +74,7 @@ export class WebViewModel implements ViewModel { partitionOverride: PrimitiveAtom | null; userAgentType: Atom; env: WebViewEnv; + ctrlShiftUnsubFn: (() => void) | null = null; constructor({ blockId, nodeModel, tabModel, waveEnv }: ViewModelInitType) { this.nodeModel = nodeModel; @@ -508,18 +509,21 @@ export class WebViewModel implements ViewModel { return true; } const ctrlShiftState = globalStore.get(getSimpleControlShiftAtom()); - if (ctrlShiftState) { + if (ctrlShiftState && !this.ctrlShiftUnsubFn) { // this is really weird, we don't get keyup events from webview - const unsubFn = globalStore.sub(getSimpleControlShiftAtom(), () => { + this.ctrlShiftUnsubFn = globalStore.sub(getSimpleControlShiftAtom(), () => { const state = globalStore.get(getSimpleControlShiftAtom()); if (!state) { - unsubFn(); + this.ctrlShiftUnsubFn?.(); + this.ctrlShiftUnsubFn = null; const isStillFocused = globalStore.get(this.nodeModel.isFocused); if (isStillFocused) { this.webviewRef.current?.focus(); } } }); + } + if (ctrlShiftState) { return false; } this.webviewRef.current?.focus(); From 8d5ef8fdee1ff011e532dcc4666ab3f7c38ceaf6 Mon Sep 17 00:00:00 2001 From: sawka Date: Tue, 24 Mar 2026 09:34:36 -0700 Subject: [PATCH 2/2] dispose --- frontend/app/view/webview/webview.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/frontend/app/view/webview/webview.tsx b/frontend/app/view/webview/webview.tsx index 02b2a8a5c1..551f23bbb7 100644 --- a/frontend/app/view/webview/webview.tsx +++ b/frontend/app/view/webview/webview.tsx @@ -212,6 +212,11 @@ export class WebViewModel implements ViewModel { }); } + dispose() { + this.ctrlShiftUnsubFn?.(); + this.ctrlShiftUnsubFn = null; + } + get viewComponent(): ViewComponent { return WebView; }