mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-01-02 18:39:05 +01:00
remove unnecessary isUrlDirty atom
This commit is contained in:
parent
f13b608e79
commit
6793b41cea
@ -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>) {
|
||||
|
Loading…
Reference in New Issue
Block a user