(feat) chain app nav to browser history state. Closes #250.

Hook browser back/forward to nav state
This commit is contained in:
Jack Kingsman
2026-05-15 22:49:20 -07:00
committed by GitHub
6 changed files with 251 additions and 11 deletions
+16
View File
@@ -172,9 +172,25 @@ export function updateUrlHash(conv: Conversation | null): void {
}
}
// Update URL hash and add a new browser history entry
export function pushUrlHash(conv: Conversation | null): void {
const newHash = getConversationHash(conv);
if (newHash !== window.location.hash) {
window.history.pushState(null, '', newHash || window.location.pathname);
}
}
export function updateSettingsHash(section: SettingsSection): void {
const newHash = getSettingsHash(section);
if (newHash !== window.location.hash) {
window.history.replaceState(null, '', newHash);
}
}
// Push a settings hash as a new browser history entry
export function pushSettingsHash(section: SettingsSection): void {
const newHash = getSettingsHash(section);
if (newHash !== window.location.hash) {
window.history.pushState(null, '', newHash);
}
}