Disable storing nav state due to bugs

zio/stable
Paul Frazee 2022-11-14 16:56:40 -06:00
parent c98edca116
commit 723dee5704
1 changed files with 34 additions and 33 deletions

View File

@ -123,37 +123,36 @@ export class NavigationTabModel {
} }
hydrate(v: unknown) { hydrate(v: unknown) {
this.history = [] // TODO fixme
this.index = 0 // if (isObj(v)) {
if (isObj(v)) { // if (hasProp(v, 'history') && Array.isArray(v.history)) {
if (hasProp(v, 'history') && Array.isArray(v.history)) { // for (const item of v.history) {
for (const item of v.history) { // if (
if ( // isObj(item) &&
isObj(item) && // hasProp(item, 'url') &&
hasProp(item, 'url') && // typeof item.url === 'string'
typeof item.url === 'string' // ) {
) { // let copy: HistoryItem = {
let copy: HistoryItem = { // url: item.url,
url: item.url, // ts:
ts: // hasProp(item, 'ts') && typeof item.ts === 'number'
hasProp(item, 'ts') && typeof item.ts === 'number' // ? item.ts
? item.ts // : Date.now(),
: Date.now(), // }
} // if (hasProp(item, 'title') && typeof item.title === 'string') {
if (hasProp(item, 'title') && typeof item.title === 'string') { // copy.title = item.title
copy.title = item.title // }
} // this.history.push(copy)
this.history.push(copy) // }
} // }
} // }
} // if (hasProp(v, 'index') && typeof v.index === 'number') {
if (hasProp(v, 'index') && typeof v.index === 'number') { // this.index = v.index
this.index = v.index // }
} // if (this.index >= this.history.length - 1) {
if (this.index >= this.history.length - 1) { // this.index = this.history.length - 1
this.index = this.history.length - 1 // }
} // }
}
} }
} }
@ -236,7 +235,9 @@ export class NavigationModel {
} }
hydrate(v: unknown) { hydrate(v: unknown) {
if (isObj(v)) { // TODO fixme
this.clear()
/*if (isObj(v)) {
if (hasProp(v, 'tabs') && Array.isArray(v.tabs)) { if (hasProp(v, 'tabs') && Array.isArray(v.tabs)) {
for (const tab of v.tabs) { for (const tab of v.tabs) {
const copy = new NavigationTabModel() const copy = new NavigationTabModel()
@ -249,6 +250,6 @@ export class NavigationModel {
if (hasProp(v, 'tabIndex') && typeof v.tabIndex === 'number') { if (hasProp(v, 'tabIndex') && typeof v.tabIndex === 'number') {
this.tabIndex = v.tabIndex this.tabIndex = v.tabIndex
} }
} }*/
} }
} }