diff options
author | Paul Frazee <pfrazee@gmail.com> | 2023-01-24 13:00:11 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-24 13:00:11 -0600 |
commit | f36c9565362b741c58672204fe0c155252affe28 (patch) | |
tree | 85d90f3caae2c8f2103ec50346f9274cf8b243c5 /src/state | |
parent | 3a90114f3afc66cfef70c71c2ee343c29e1f3e8d (diff) | |
download | voidsky-f36c9565362b741c58672204fe0c155252affe28.tar.zst |
Resolve all remaining lint issues (#88)
* Rework 'navIdx' variables from number arrays to strings to avoid equality-check failures in react hooks * Resolve all remaining lint issues * Fix tests * Use node v18 in gh action test
Diffstat (limited to 'src/state')
-rw-r--r-- | src/state/models/navigation.ts | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/state/models/navigation.ts b/src/state/models/navigation.ts index 8d69e5c04..224ffef0d 100644 --- a/src/state/models/navigation.ts +++ b/src/state/models/navigation.ts @@ -3,7 +3,7 @@ import {TABS_ENABLED} from '../../build-flags' let __id = 0 function genId() { - return ++__id + return String(++__id) } // NOTE @@ -24,10 +24,10 @@ interface HistoryItem { url: string ts: number title?: string - id: number + id: string } -export type HistoryPtr = [number, number] +export type HistoryPtr = string // `{tabId}-{historyId}` export class NavigationTabModel { id = genId() @@ -151,7 +151,7 @@ export class NavigationTabModel { } } - setTitle(id: number, title: string) { + setTitle(id: string, title: string) { this.history = this.history.map(h => { if (h.id === id) { return {...h, title} @@ -174,7 +174,7 @@ export class NavigationTabModel { } } - hydrate(v: unknown) { + hydrate(_v: unknown) { // TODO fixme // if (isObj(v)) { // if (hasProp(v, 'history') && Array.isArray(v.history)) { @@ -241,7 +241,7 @@ export class NavigationModel { return this.tabs.length } - isCurrentScreen(tabId: number, index: number) { + isCurrentScreen(tabId: string, index: number) { return this.tab.id === tabId && this.tab.index === index } @@ -257,7 +257,8 @@ export class NavigationModel { } setTitle(ptr: HistoryPtr, title: string) { - this.tabs.find(t => t.id === ptr[0])?.setTitle(ptr[1], title) + const [tid, hid] = ptr.split('-') + this.tabs.find(t => t.id === tid)?.setTitle(hid, title) } handleLink(url: string) { @@ -338,7 +339,7 @@ export class NavigationModel { } } - hydrate(v: unknown) { + hydrate(_v: unknown) { // TODO fixme this.clear() /*if (isObj(v)) { |