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

reset history title after push/replace but prior to assignment to location #10605

Merged
merged 2 commits into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/eighty-olives-destroy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"astro": patch
---

Fixes an issue with outdated page titles in browser history when using text fragments in view transition navigation.
2 changes: 1 addition & 1 deletion packages/astro/src/transitions/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ const moveToLocation = (
);
}
}
document.title = targetPageTitle;
// now we are on the new page for non-history navigations!
// (with history navigation page change happens before popstate is fired)
originalLocation = to;
Expand Down Expand Up @@ -212,7 +213,6 @@ const moveToLocation = (
}
history.scrollRestoration = 'manual';
}
document.title = targetPageTitle;
};

function preloadStyleLinks(newDocument: Document) {
Expand Down