refactor: Update names & types for nav handler to make it more clear#99
Merged
rschristian merged 2 commits intomainfrom Jun 25, 2025
Merged
refactor: Update names & types for nav handler to make it more clear#99rschristian merged 2 commits intomainfrom
rschristian merged 2 commits intomainfrom
Conversation
rschristian
commented
Jun 25, 2025
Comment on lines
-37
to
-38
| } else if (typeof url === 'string') { | ||
| push = true; |
Member
Author
There was a problem hiding this comment.
This branch has been dead since #8.
It used to support the route() function for programmatic nav, but with the addition of the replace parameter, that uses the form of handleNav({ url, replace }) -- it's no longer a singular string param.
rschristian
commented
Jun 25, 2025
|
|
||
| /** | ||
| * @param {string} state | ||
| * @param {MouseEvent | PopStateEvent | { url: string, replace?: boolean }} action |
Member
Author
There was a problem hiding this comment.
By no means does the following code pass TS's inspection, but it's at least easy to reason about. We can always sprinke in instanceof or prop in action checks later if really needed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
UPDATEhas become a bit unclear over the years, largely due to the naming of the reducer action (url). This can be an event, a string, an object containingurl&replaceproperties for programmatic nav, etc. Needed a bit of a rename.Largely copies work from #75.