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>;
|
viewName: jotai.Atom<string>;
|
||||||
viewText: jotai.Atom<HeaderElem[]>;
|
viewText: jotai.Atom<HeaderElem[]>;
|
||||||
url: jotai.PrimitiveAtom<string>;
|
url: jotai.PrimitiveAtom<string>;
|
||||||
isUrlDirty: jotai.PrimitiveAtom<boolean>;
|
|
||||||
urlInput: jotai.PrimitiveAtom<string>;
|
urlInput: jotai.PrimitiveAtom<string>;
|
||||||
urlInputFocused: jotai.PrimitiveAtom<boolean>;
|
urlInputFocused: jotai.PrimitiveAtom<boolean>;
|
||||||
isLoading: jotai.PrimitiveAtom<boolean>;
|
isLoading: jotai.PrimitiveAtom<boolean>;
|
||||||
@ -40,7 +39,6 @@ export class WebViewModel implements ViewModel {
|
|||||||
this.blockAtom = WOS.getWaveObjectAtom<Block>(`block:${blockId}`);
|
this.blockAtom = WOS.getWaveObjectAtom<Block>(`block:${blockId}`);
|
||||||
|
|
||||||
this.url = jotai.atom();
|
this.url = jotai.atom();
|
||||||
this.isUrlDirty = jotai.atom(false);
|
|
||||||
this.urlInput = jotai.atom("");
|
this.urlInput = jotai.atom("");
|
||||||
this.urlWrapperClassName = jotai.atom("");
|
this.urlWrapperClassName = jotai.atom("");
|
||||||
this.urlInputFocused = jotai.atom(false);
|
this.urlInputFocused = jotai.atom(false);
|
||||||
@ -53,9 +51,8 @@ export class WebViewModel implements ViewModel {
|
|||||||
|
|
||||||
this.viewText = jotai.atom((get) => {
|
this.viewText = jotai.atom((get) => {
|
||||||
let url = get(this.blockAtom)?.meta?.url || "";
|
let url = get(this.blockAtom)?.meta?.url || "";
|
||||||
const urlIsDirty = get(this.isUrlDirty);
|
const currUrl = get(this.url);
|
||||||
if (urlIsDirty) {
|
if (currUrl !== undefined) {
|
||||||
const currUrl = get(this.url);
|
|
||||||
url = currUrl;
|
url = currUrl;
|
||||||
}
|
}
|
||||||
return [
|
return [
|
||||||
@ -168,7 +165,6 @@ export class WebViewModel implements ViewModel {
|
|||||||
|
|
||||||
handleUrlChange(event: React.ChangeEvent<HTMLInputElement>) {
|
handleUrlChange(event: React.ChangeEvent<HTMLInputElement>) {
|
||||||
globalStore.set(this.url, event.target.value);
|
globalStore.set(this.url, event.target.value);
|
||||||
globalStore.set(this.isUrlDirty, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
handleKeyDown(event: React.KeyboardEvent<HTMLInputElement>) {
|
handleKeyDown(event: React.KeyboardEvent<HTMLInputElement>) {
|
||||||
|
Loading…
Reference in New Issue
Block a user