Fix back to candidate with history (#975)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev 2022-02-08 23:01:57 +07:00 committed by GitHub
parent 250937c175
commit 6b7f3a9f7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View File

@ -111,6 +111,8 @@ export const location = derived(locationWritable, (loc) => loc)
export function navigate (location: PlatformLocation): void {
const url = locationToUrl(location)
history.pushState(null, '', url)
locationWritable.set(location)
if (locationToUrl(getCurrentLocation()) !== url) {
history.pushState(null, '', url)
locationWritable.set(location)
}
}

View File

@ -17,7 +17,7 @@ location.subscribe((loc) => {
if (loc.fragment !== currentLocation && loc.fragment !== undefined && loc.fragment.trim().length > 0) {
const props = decodeURIComponent(loc.fragment).split('|')
showPanel(props[0] as AnyComponent, props[1], props[2], 'full')
} else if (loc.fragment === '' || (loc.fragment !== undefined && loc.fragment.trim().length === 0)) {
} else if ((loc.fragment === undefined || (loc.fragment !== undefined && loc.fragment.trim().length === 0)) && currentLocation !== undefined) {
closePanel()
}
})