This commit is contained in:
Classic298 2026-11-01 16:34:07 +01:00 • committed by GitHub
commit 1c935685be
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1929,6 +1929,10 @@
});
}
if ($page.url.pathname === '/' || $page.url.pathname.startsWith('/folders/')) {
tick().then(initNewChat);
}
// the artifacts pane reads this list when it opens, which can be before the debounced rebuild
const showArtifactsSubscribe = showArtifacts.subscribe((value) => {
if (value) getContents();
@ -2461,8 +2465,12 @@
return () => bridge?.end();
});
// Only real navigation resets the chat; shallow sidebar state changes must preserve it.
afterNavigate(async ({ to }) => {
if (to?.url.pathname === '/' || to?.url.pathname.startsWith('/folders/')) {
afterNavigate(async ({ from, to }) => {
// A navigation that mounts this page starts its new chat in onMount.
if (
from?.route.id === to?.route.id &&
(to?.url.pathname === '/' || to?.url.pathname.startsWith('/folders/'))
) {
await tick();
initNewChat();
}