sveltejs / svelte

Cybernetically enhanced web apps
https://svelte.dev
MIT License
76.97k stars 4k forks source link

<component> childrens in svelte:head are not destroyed from route to route #9332

Open enda opened 7 months ago

enda commented 7 months ago

Describe the bug

When using a component in , the component is not destroy when route change

Maybe related: https://github.com/sveltejs/svelte/issues/9329

Reproduction

Create an app

npm create svelte@latest my-app
cd my-app
npm install
npm run dev -- --open

Create a component Test.svelte:

<!-- Test.svelte -->
<link rel="hello" as="world" />

Edit src/routes/+page.svelte Add component in

Open browser and console, change route, the <link rel="hello" as="world" /> is still there. Go back to home, the <link rel="hello" as="world" /> is present twice.

Logs

No log

System Info

System:
    OS: macOS 13.5.2
    CPU: (8) x64 Intel(R) Core(TM) i7-8557U CPU @ 1.70GHz
    Memory: 174.19 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 16.17.0 - ~/.nvm/versions/node/v16.17.0/bin/node
    npm: 8.15.0 - ~/.nvm/versions/node/v16.17.0/bin/npm
  Browsers:
    Chrome: 118.0.5993.70
    Safari: 16.6
  npmPackages:
    @sveltejs/adapter-auto: ^2.0.0 => 2.1.0 
    @sveltejs/adapter-node: ^1.3.1 => 1.3.1 
    @sveltejs/kit: ^1.20.4 => 1.25.2 
    svelte: ^4.0.5 => 4.2.1 
    vite: ^4.4.2 => 4.4.11

Severity

annoyance

enda commented 2 months ago

any update on this one ?

It still a bug on svelte 4.2.12

  System:
    OS: macOS 14.2.1
    CPU: (8) x64 Intel(R) Core(TM) i7-8557U CPU @ 1.70GHz
    Memory: 472.61 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.20.0 - ~/.nvm/versions/node/v18.20.0/bin/node
    npm: 10.5.0 - ~/.nvm/versions/node/v18.20.0/bin/npm
  Browsers:
    Chrome: 123.0.6312.87
    Safari: 17.2.1
  npmPackages:
    svelte: ^4.0.5 => 4.2.12