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
This commit is contained in:
parent
3a90114f3a
commit
f36c956536
60 changed files with 478 additions and 482 deletions
|
@ -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)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue