Skip to content

Navigating store isn't set to null when navigating is aborted #4660

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
susickypavel opened this issue Apr 19, 2022 · 1 comment · Fixed by #4664
Closed

Navigating store isn't set to null when navigating is aborted #4660

susickypavel opened this issue Apr 19, 2022 · 1 comment · Fixed by #4664

Comments

@susickypavel
Copy link

Describe the bug

The navigation store value isn't set to null after successful navigation to a page. The problem occurs only when navigation to a page is aborted by navigating to another page.

I think this is a bug because according to the docs the navigating should be set null after successful navigation (and all other navigations are aborted).

Reproduction

/second is an artificially slowed-down page to make reproduction easier.

  1. Click on the /second link
  2. Before /second loads, click on /third

You will see that conditionally rendered HTML from Something.svelte stay rendered.

https://stackblitz.com/edit/sveltejs-kit-template-default-kajrov?file=src/routes/index.svelte

Logs

No response

System Info

System:
    OS: Windows 10 10.0.22000
    CPU: (12) x64 AMD Ryzen 5 3600 6-Core Processor
    Memory: 18.62 GB / 31.95 GB
  Binaries:
    Node: 16.13.1 - E:\scoop\apps\nodejs-lts\current\node.EXE
    Yarn: 1.22.15 - E:\scoop\apps\nodejs\current\bin\yarn.CMD
    npm: 8.1.2 - E:\scoop\apps\nodejs-lts\current\npm.CMD
  Browsers:
    Edge: Spartan (44.22000.120.0), Chromium (98.0.1108.55)
    Internet Explorer: 11.0.22000.120
  npmPackages:
    @sveltejs/adapter-vercel: next => 1.0.0-next.47
    @sveltejs/kit: next => 1.0.0-next.315
    svelte: ^3.44.0 => 3.47.0

Severity

annoyance

Additional Information

I traced the problem to be in this file.

The problem is conditions on lines 921 and 923. As condition 923 blocks navigating reset because there's a stall navigating (navigation == 1 in the repro, specifically the /second route navigating) and condition 921 blocks the late-returned await update from /second to clean-up.

This seems like a not-so-hard problem to solve. However, I'm not brave enough to make a PR, with a little bit of guidance I'll be glad to help with this out (if needed) 😊

@susickypavel susickypavel changed the title navigating store isn't set to null when aborted Navigating store isn't set to null when navigating is aborted Apr 19, 2022
@susickypavel
Copy link
Author

I'm iterating over ideas on how to solve this issue.

Is the navigating variable (client.js:496) along with the condition on 923 needed? It seems to me that current_navigating_token and navigating_token should have the same effect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant