Merge pull request #13832 from Ithanil/svelte_versioning

feat: Handle frontend updates according to Svelte docs
This commit is contained in:
Tim Jaeryang Baek
2025-05-14 17:19:32 +04:00
committed by GitHub
3 changed files with 20 additions and 1 deletions

View File

@@ -49,6 +49,16 @@
import AppSidebar from '$lib/components/app/AppSidebar.svelte';
import { chatCompletion } from '$lib/apis/openai';
import { beforeNavigate } from '$app/navigation';
import { updated } from '$app/state';
// handle frontend updates (https://svelte.dev/docs/kit/configuration#version)
beforeNavigate(({ willUnload, to }) => {
if (updated.current && !willUnload && to?.url) {
location.href = to.url.href;
}
});
setContext('i18n', i18n);
const bc = new BroadcastChannel('active-tab-channel');