Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(client): No onAfterRouteChanged called after popstate #3227

Merged
merged 3 commits into from
Nov 22, 2023

Conversation

xiaodong2008
Copy link
Contributor

This Pull Request Fix issue #3226: No onAfterRouteChanged called after popstate

In src/client/app/router.ts popstate eventListener, it should call onAfterRouteChanged hook after loadPage,
but it is missing.

...
    window.addEventListener('popstate', (e) => {
      loadPage(
        normalizeHref(location.href),
        (e.state && e.state.scrollPosition) || 0
-      )
+      ).then(() => {
+        router.onAfterRouteChanged?.(location.href)
+      })
    })
...

Before Fix:
Screenshot 2023-11-20 at 9 26 52 PM

After Fix:
Screenshot 2023-11-20 at 9 29 02 PM

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@brc-dd brc-dd merged commit 60fc8fd into vuejs:main Nov 22, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants