Skip to content
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

Potential fix for strict mode bug #58

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Hawxy
Copy link

@Hawxy Hawxy commented Jan 28, 2021

Hello @mblarsen,

I was testing strict mode and noticed that it doesn't appear to work correctly.

As metas in the route guard filters out routes without can, you can end up with an empty metas array, then chainCans will simply resolve true via the reduce's initialValue and bypass the strict mode checks entirely.

The test in this PR currently fails, demonstrating the behavior.

@mblarsen
Copy link
Owner

mblarsen commented Feb 4, 2021

Thanks for the time you've taken to create the tests. Currently I don't have the time to work on it. Would you be able to try making a PR for it?

@Hawxy Hawxy changed the title Add test with strict mode bug Potential fix for strict mode bug Feb 7, 2021
@Hawxy
Copy link
Author

Hawxy commented Feb 7, 2021

I added a potential fix for this issue, however I'm unsure what the behavior should be if the fallback route itself has no can meta, without a check in place the router guard just infinitely loops. I've set it to bypass any checks on the fallback route if strict mode is enabled, but perhaps it should throw an error instead.

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.

None yet

2 participants