I am developing an application using Laravel, Inertia and Svelte. It's currently running SSR.
Here's a simple code snippet that I use to set up the <title>
tag in the <head>
section, using Svelte:
import { title, desc } from '@/utils/app';...<svelte:head><title>{$title}</title> {#if $desc}<meta name="description" content={$desc}><meta name="og:description" content={$desc}><meta name="twitter:description" content={$desc}> {/if}</svelte:head>
Both title
and desc
are writable stores. Now I am facing an extremely strange issue.
When I visit a page A, and then inspect the HTML source code to make sure that SSR is working perfectly, I get the title "Page A" in <title>
for page A. So far, so good.
Now if I visit a page B in another tab, I get the title "Page B". Surprisingly, refreshing page A's source in the previous tab also shows "Page B" in <title>
.
Why is this happening?
It seems as if though the Node.js process running in the background for SSR, launched by Laravel Inertia, is not getting destroyed after server-side rendering for a given request. It seems that the writable stores are retaining their old values. But still I'm not sure what exactly is happening here and why?