Closed pelly-ryu closed 2 months ago
Can you publish a reproduction?
Actually, I ain't sure I understand your issue. Why not using navigate()
instead of history.pushState()
?
Closing, but let's continue the conversation and let's re-open if it turns out to be a Vike bug.
Oh I missed your comments, sorry for late response. Thanks for following up on this.
Summary:
navigate
), so I'm no longer experiencing the problem.I just tried to reproduce it but couldn't. Back when I first reported this, not sure why, the isHashNavigation
value seemed off, but that's not the case anymore. So either there's no bug or I couldn't recreate the environment where the bug occurred.
FYI, Here's what I initially tried to fix it : (source: https://github.com/pelly-ryu/vike-backward-nav )
https://github.com/user-attachments/assets/77376867-ac5b-43e0-83c3-5231637a56d1
There's still some quirky behavior, but it seems not to due to a Vike's bug. Given that I've moved to a different implementation, I won't be pursuing this further.
Description
How to reproduce
/seeks
)history.pushState()
to mutate the URL. (result:/seeks?category=etc
)Expected behavior
External
the page's content changes to the previous page's (result: shows result with no category selected.)
Internal
as URL hash changed(
/seeks?category=etc
->/seeks
),isHashNavigation
isfalse
ornull
, sorenderPageClientSide
is called.Actual behavior
External
the page's content doesn't change; shows the wrong(old) result.
Internal
Though it is not a hash navigation,
isHashNavigation
istrue
. So Vike sets only the scroll position.Comment
triggeredBy=user
totriggeredBy=user
. It can be handled as the doc describes.globalObject.previousState.urlWithoutHash
, and of course it did, because Vike had no way to store the previous URL which had been changed via history API.navigate
) wrappinghistory.pushState
and remember urls.pushState
s tonavigate
, though need to test first if it is possible. But generally, I think it is a bug.