Skip to content

Conversation

richardjelinek-fastest
Copy link
Contributor

@richardjelinek-fastest richardjelinek-fastest commented Jul 3, 2025

Tries to fix #118

Passes initial URL parameters to onNavigate so we can catch them in beforeLoad at page load.
Hopefully cancel all navigations if they're not the most recent one. Old logic did not work from my tests.

Return Error in navigate so linters (ESLint) don't complain about throwing void.

Copy link

changeset-bot bot commented Jul 3, 2025

🦋 Changeset detected

Latest commit: f0792b7

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Jul 3, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
sv-router Ignored Ignored Preview Sep 16, 2025 4:49pm

@richardjelinek-fastest richardjelinek-fastest force-pushed the correct-default-navigate branch 4 times, most recently from 50f231c to ace70ee Compare July 3, 2025 21:46
@colinlienard
Copy link
Owner

Hopefully cancel all navigations if they're not the most recent one. Old logic did not work from my tests.

@richardjelinek-fastest Curious to see your method of test, I didn’t see issues when testing this, but maybe I missed something

@richardjelinek-fastest
Copy link
Contributor Author

Hopefully cancel all navigations if they're not the most recent one. Old logic did not work from my tests.

@richardjelinek-fastest Curious to see your method of test, I didn’t see issues when testing this, but maybe I missed something

I've created a min-repro demo: https://github.com/richardjelinek-fastest/sv-router-navigation-bug

@colinlienard
Copy link
Owner

I don't see the issue in your repro 🤔

@richardjelinek-fastest
Copy link
Contributor Author

richardjelinek-fastest commented Jul 8, 2025

I don't see the issue in your repro 🤔

Ok I now see why.
It only happens after a hot-reload.

I also added a new condition that redirects from the homepage, so you don't have to go into the /nested page to check the possible bug.

@richardjelinek-fastest
Copy link
Contributor Author

@colinlienard Do you plan to look into it? 👀 Just bumping, it's okay if you're busy :)

@colinlienard
Copy link
Owner

I was still not able to reproduce the issue...

@richardjelinek-fastest richardjelinek-fastest force-pushed the correct-default-navigate branch 2 times, most recently from 3d00fee to f399edc Compare August 19, 2025 19:33
@richardjelinek-fastest
Copy link
Contributor Author

richardjelinek-fastest commented Aug 19, 2025

@colinlienard Ok it's not that easily reproducible. Here's a video of the weird bug happening.
It seems to work when opening the site a certain way.

I've also updated the repro demo once again...

Working on an update to this PR. It's missing the change that seems to fix it.

Screencast_20250819_212333.webm

@richardjelinek-fastest richardjelinek-fastest changed the title fix: pass initial page pathname, search, hash to onNavigate, correctly handle cancellation of navigations, return Error in navigate fix: correctly handle cancellation of navigations, return Error in navigate Aug 19, 2025
@richardjelinek-fastest richardjelinek-fastest force-pushed the correct-default-navigate branch 2 times, most recently from 72d012c to 61c9085 Compare August 19, 2025 19:57
@richardjelinek-fastest
Copy link
Contributor Author

Don't know why the test is failing in the actions. Locally it passes :'(

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 this pull request may close these issues.

navigate on page load

2 participants