Description
While searching for a solution to keep SharedWorker alive durning reload and keeping the state intact and not having to fetch all the resources over again and again durning page reload / navigation when only having one tab open
i found out that my SharedWorker was terminated when the current page died. and the state in the shared worker where lost.
i only have one tab open but i would wish for it to stay alive to the next page.
I happen to stumble upon this in the spec:
The second part of this definition allows a shared worker to survive for a short time while a page is loading, in case that page is going to contact the shared worker again. This can be used by user agents as a way to avoid the cost of restarting a shared worker used by a site when the user is navigating from page to page within that site.
https://html.spec.whatwg.org/multipage/workers.html#the-worker's-lifetime
I tried every way i could think of to keep the SharedWorker alive but it ended in failure.
Tried reload the page, tried navigating to a page
where also about to try portals but that trail period have ended and i don't see a chrome flag for it anymore. maybe it was something about being replaced with "View Transition"