Stories: Back into a deleted story's entry clears ?story= from the address

This commit is contained in:
Sameh Khamis committed 2026-11-16 13:36:13 -08:00
1 parent 7a0b649bf5
commit 85c9f95838
2 files changed
+30 -7

No files matched your search

+12 -7
View File
@@ -268,13 +268,18 @@ export function createStoriesController({
? controller.open({ fromHistory: true })
: controller.backToExplore({ fromHistory: true, returningToExplore });
else if (store.mode !== 'closed') controller.close({ fromHistory: true });
else if (pendingView) {
// Another browser navigation landed while the scene was stopping.
// The destination owns the globe now, so discard the earlier restore.
pendingView = null;
closeGeneration += 1;
document.body.classList.remove('stories-mode');
shareLink()?.holdWrites?.(false);
else {
// An entry for a story that is gone (deleted since) opens nothing;
// its ?story= must not stay in the address for the next share link.
if (id) clearStoriesUrl();
if (pendingView) {
// Another browser navigation landed while the scene was stopping.
// The destination owns the globe now, so discard the earlier restore.
pendingView = null;
closeGeneration += 1;
document.body.classList.remove('stories-mode');
shareLink()?.holdWrites?.(false);
}
}
}
addEventListener('popstate', onPopState);