solidjs / solid-router

A universal router for Solid inspired by Ember and React Router
MIT License
1.1k stars 137 forks source link

Make isRouting more reliable + other fixes #442

Closed jpdutoit closed 4 weeks ago

jpdutoit commented 1 month ago

I set out to fix #311, but in doing so discovered a few other issues

The isRouting value was not very reliable, and could change many times between true and false

This PR changes isRouting to update once to true when routing starts, and then back to false when routing ends - but only after the source has been updated. The ordering will allow one to use isRouting turning false as a trigger for when it is safe to update your document title. I added tests for these.

While doing this I discovered and fixed the following issues:

Question: I noticed that a transition was started on creation. Is that initial transition important? I currently have it commented out.

changeset-bot[bot] commented 1 month ago

🦋 Changeset detected

Latest commit: 2f05f3733584c7ad82faeabe194908352ac34008

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

This PR includes changesets to release 1 package | Name | Type | | --------------- | ----- | | @solidjs/router | Patch |

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

jpdutoit commented 4 weeks ago

Pulled in your improvements, and added a few minor ones on top

ryansolid commented 4 weeks ago

Thanks you both.