-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Closed as not planned
Description
Describe the problem
I expect this example to work. That is, when a component is unmounted that contains the following code:
<svelte:head>
<title>Title</title>
</svelte:head>it should reset the document.title to the previous value.
This is particularly relevant when using shallow routing, where rendering a page component manually is recommended.
Describe the proposed solution
Something like
$.head(($$anchor) => {
const previous_title = $.document.title;
$.teardown(() => {
$.document.title = previous_title;
});
$.document.title = `title`;
});I'm not sure whether there would need to be some global queue of titles, i.e.
const title_queue = [];
function set_title(title) {
render_effect(() => {
title_queue.push(document.title);
document.title = title;
return () => {
if (title_queue.length === 0) return;
document.title = title_queue.pop();
};
});
}Importance
would make my life easier
Metadata
Metadata
Assignees
Labels
No labels