diff options
Diffstat (limited to 'gui/src/renderer/lib')
| -rw-r--r-- | gui/src/renderer/lib/history.ts | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/gui/src/renderer/lib/history.ts b/gui/src/renderer/lib/history.ts index 68553f77c7..3f98508ce1 100644 --- a/gui/src/renderer/lib/history.ts +++ b/gui/src/renderer/lib/history.ts @@ -80,6 +80,13 @@ export default class History { this.notify(affectedEntries); }; + public resetWithIfDifferent = (nextLocation: LocationDescriptor<S>, nextState?: S) => { + const location = this.createLocation(nextLocation, nextState); + if (this.entries[0].pathname !== location.pathname) { + this.resetWith(nextLocation, nextState); + } + }; + public canGo(n: number) { const nextIndex = this.index + n; return nextIndex >= 0 && nextIndex < this.entries.length; |
