From 6793b41cead6f051f0ca7c6cdf7590418ecba8bf Mon Sep 17 00:00:00 2001 From: Evan Simkowitz Date: Tue, 10 Sep 2024 14:59:34 -0700 Subject: [PATCH] remove unnecessary isUrlDirty atom --- frontend/app/view/webview/webview.tsx | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/frontend/app/view/webview/webview.tsx b/frontend/app/view/webview/webview.tsx index 6f616220d..3b5ecbb31 100644 --- a/frontend/app/view/webview/webview.tsx +++ b/frontend/app/view/webview/webview.tsx @@ -23,7 +23,6 @@ export class WebViewModel implements ViewModel { viewName: jotai.Atom; viewText: jotai.Atom; url: jotai.PrimitiveAtom; - isUrlDirty: jotai.PrimitiveAtom; urlInput: jotai.PrimitiveAtom; urlInputFocused: jotai.PrimitiveAtom; isLoading: jotai.PrimitiveAtom; @@ -40,7 +39,6 @@ export class WebViewModel implements ViewModel { this.blockAtom = WOS.getWaveObjectAtom(`block:${blockId}`); this.url = jotai.atom(); - this.isUrlDirty = jotai.atom(false); this.urlInput = jotai.atom(""); this.urlWrapperClassName = jotai.atom(""); this.urlInputFocused = jotai.atom(false); @@ -53,9 +51,8 @@ export class WebViewModel implements ViewModel { this.viewText = jotai.atom((get) => { let url = get(this.blockAtom)?.meta?.url || ""; - const urlIsDirty = get(this.isUrlDirty); - if (urlIsDirty) { - const currUrl = get(this.url); + const currUrl = get(this.url); + if (currUrl !== undefined) { url = currUrl; } return [ @@ -168,7 +165,6 @@ export class WebViewModel implements ViewModel { handleUrlChange(event: React.ChangeEvent) { globalStore.set(this.url, event.target.value); - globalStore.set(this.isUrlDirty, true); } handleKeyDown(event: React.KeyboardEvent) {