Skip to content

Subscribing to $page in layout and using transition causes page to not be cleared on navigation #9314

@Fish1

Description

@Fish1

Describe the bug

Having a route with $page access in the layout, and the use of a transition on the page, causes the page to not be cleared on navigation.

Video.webm

Reproduction

image

In this file structure we have a / page and a /app page. The /app page has a layout which accesses the $page store, while the page itself has a transition on an element.

The / page is juat a button to the /app page.

/app +layout.svelte

<script lang="ts">
    import { page } from '$app/stores';
    // this $page results in the page not being removed after navigation
    $page;
</script>

<slot />

/app +page.svelte

<script>
  import { fade } from "svelte/transition";
</script>

<div>
    <h2>APP PAGE</h2>
    <a href="/">Goto Home</a>
    <!-- this transition results in the page not being removed after navigation -->
    <div transition:fade>This uses transition</div>
</div>

/ +page.svelte

<div>
    <h1>HOME PAGE</h1>
    <a href="/app">GoTo Problem</a>
</div>

Repo: https://github.com/Fish1/sveltekit-bug

Logs

I don't see sveltekit producing any error logs.

System Info

System:
    OS: Linux 5.15 openSUSE Tumbleweed 20230302
    CPU: (12) x64 AMD Ryzen 5 5600X 6-Core Processor
    Memory: 9.76 GB / 15.57 GB
    Container: Yes
    Shell: 3.6.0 - /usr/bin/fish
  Binaries:
    Node: 18.13.0 - ~/.local/share/nvm/v18.13.0/bin/node
    Yarn: 1.22.19 - ~/.local/share/nvm/v18.13.0/bin/yarn
    npm: 8.19.3 - ~/.local/share/nvm/v18.13.0/bin/npm
  npmPackages:
    @sveltejs/adapter-auto: ^2.0.0 => 2.0.0 
    @sveltejs/adapter-node: ^1.2.1 => 1.2.1 
    @sveltejs/kit: ^1.5.0 => 1.10.0 
    svelte: ^3.54.0 => 3.55.1 
    vite: ^4.0.0 => 4.1.4

Severity

serious, but I can work around it

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions