-
-
Notifications
You must be signed in to change notification settings - Fork 5k
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
Static matcher #3713
Closed
Closed
Static matcher #3713
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
7852bbf
feat(static matching): Static matching optimization.
iurisilvio 34b32fc
feat(static matching): Ignore routes that will never match.
iurisilvio 645780e
test(static matching): Remove create map spec implementation detail.
iurisilvio 60ff22c
chore: Cleanup.
iurisilvio f533dfa
fix: flow
iurisilvio 5b6ed7c
test(static matching): Test strict child.
iurisilvio File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should still work. Were they removed by accident?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed because the previous rule always match before, the strict flag is false by default.
I was not convinced about this behavior, so I wrote a test to validate it.
https://github.com/buserbrasil/vue-router/commit/c247c520d121b4847d0e9d88db5368885e5bd931
I think it is an implementation detail and don't change any behavior.
It is possible to maintain them in the list, but I have to think how to do it without increasing the size.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My change remove static rules that will never match because you have another rule matching before. This way I can trust if it exists in path map, it should be used instead of running through the matching loop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, these need to be added back, allowing a trailing slash when strict is false is necessary. If you think this is too much, that's fine, it's better to drop these changes on v3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the test to assert that the parent route is not removed from the list when child route is strict. It don't change matching behavior.
/bar
was not removed because/bar/
is strict, but/bar-redirect
will never be reached, so it was removed.I'm ok if it is not merged and I'll work on v3 soon to avoid O(n) matches.