Skip to content
This repository was archived by the owner on Jan 11, 2023. It is now read-only.
This repository was archived by the owner on Jan 11, 2023. It is now read-only.

onMount is getting fired again on page change (same route) #1473

Open
@shank233

Description

@shank233

Describe the bug
I created a sapper svelte application and some weird thing is happening.
Once the page is rendered on the client side from the server, I click on a page "A" which has an component "comp1". This component contains onMount lifecycle method.
Now if I click on page "B" which doesn't have component "comp1" but still it calls the onMount lifecycle method of "comp1".
Now if I click on page "C" (which doesn't have component "comp1") after page "B" then "comp1" onMount method is not called.
If I directly click from page "A" to page "C" then "comp1" onMount method is getting called.
So any immediate click on another page from page "A" calls the "comp1" onMount method.

I have create routes/[...slug].svelte file so any path on the browser will match to this file except / which will map to routes/index.svelte.
Both routes/[...slug].svelte and routes/index.svelte has same code.
Also components are getting rendered dynamically using svelte:component.
_layout.svelte is not getting used and it has been renamed to __layout.svelte.

To Reproduce
"svelte": "^3.17.3",
"sapper": "^0.28.0",

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