remove unnecessary isUrlDirty atom

This commit is contained in:
Evan Simkowitz 2024-09-10 14:59:34 -07:00
parent f13b608e79
commit 6793b41cea
No known key found for this signature in database

View File

@ -23,7 +23,6 @@ export class WebViewModel implements ViewModel {
viewName: jotai.Atom<string>;
viewText: jotai.Atom<HeaderElem[]>;
url: jotai.PrimitiveAtom<string>;
isUrlDirty: jotai.PrimitiveAtom<boolean>;
urlInput: jotai.PrimitiveAtom<string>;
urlInputFocused: jotai.PrimitiveAtom<boolean>;
isLoading: jotai.PrimitiveAtom<boolean>;
@ -40,7 +39,6 @@ export class WebViewModel implements ViewModel {
this.blockAtom = WOS.getWaveObjectAtom<Block>(`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<HTMLInputElement>) {
globalStore.set(this.url, event.target.value);
globalStore.set(this.isUrlDirty, true);
}
handleKeyDown(event: React.KeyboardEvent<HTMLInputElement>) {