diff options
Diffstat (limited to 'src/state/models')
-rw-r--r-- | src/state/models/navigation.ts | 7 | ||||
-rw-r--r-- | src/state/models/root-store.ts | 1 |
2 files changed, 7 insertions, 1 deletions
diff --git a/src/state/models/navigation.ts b/src/state/models/navigation.ts index feb03b367..9cbc678d0 100644 --- a/src/state/models/navigation.ts +++ b/src/state/models/navigation.ts @@ -2,6 +2,7 @@ import {RootStoreModel} from './root-store' import {makeAutoObservable} from 'mobx' import {TABS_ENABLED} from 'lib/build-flags' import {segmentClient} from 'lib/analytics' +import {getHistory} from 'platform/urls' let __id = 0 function genId() { @@ -41,6 +42,7 @@ export type HistoryPtr = string // `{tabId}-{historyId}` export class NavigationTabModel { id = genId() history: HistoryItem[] + browserHistory: any index = 0 isNewTab = false @@ -48,6 +50,7 @@ export class NavigationTabModel { this.history = [ {url: TabPurposeMainPath[fixedTabPurpose], ts: Date.now(), id: genId()}, ] + this.browserHistory = getHistory() makeAutoObservable(this, { serialize: false, hydrate: false, @@ -122,6 +125,7 @@ export class NavigationTabModel { this.history.push({url: fixedUrl, ts: Date.now(), id: genId()}) } this.history.push({url, title, ts: Date.now(), id: genId()}) + this.browserHistory.push(url) this.index = this.history.length - 1 } } @@ -142,6 +146,7 @@ export class NavigationTabModel { goBack() { if (this.canGoBack) { this.index-- + this.browserHistory.back() } } @@ -155,12 +160,14 @@ export class NavigationTabModel { goForward() { if (this.canGoForward) { this.index++ + this.browserHistory.forward() } } goToIndex(index: number) { if (index >= 0 && index <= this.history.length - 1) { this.index = index + this.browserHistory.go(index) } } diff --git a/src/state/models/root-store.ts b/src/state/models/root-store.ts index 11d496351..229c7b3c0 100644 --- a/src/state/models/root-store.ts +++ b/src/state/models/root-store.ts @@ -120,7 +120,6 @@ export class RootStoreModel { async handleSessionChange(agent: AtpAgent) { this.log.debug('RootStoreModel:handleSessionChange') this.agent = agent - this.nav.clear() this.me.clear() await this.me.load() } |