mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-21 07:46:24 +00:00
Fix desktop app history navigation (#3611)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
parent
0dd2fe3d72
commit
d0b3a48b6c
@ -122,6 +122,12 @@ if (!embeddedPlatform) {
|
||||
window.addEventListener('popstate', () => {
|
||||
locationWritable.set(getRawCurrentLocation())
|
||||
})
|
||||
} else {
|
||||
window.addEventListener('popstate', (state) => {
|
||||
if (state.state.location !== undefined) {
|
||||
locationWritable.set(state.state.location)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export const location = derived(locationWritable, (loc) => justClone(loc))
|
||||
@ -167,6 +173,8 @@ export function navigate (location: PlatformLocation, store = true): boolean {
|
||||
if (store) {
|
||||
if (!embeddedPlatform) {
|
||||
history.pushState(null, '', url)
|
||||
} else {
|
||||
history.pushState({ location }, '')
|
||||
}
|
||||
localStorage.setItem(locationStorageKeyId, JSON.stringify(location))
|
||||
if (location.path[1] !== undefined) {
|
||||
|
Loading…
Reference in New Issue
Block a user