vue-browser-acl
vue-browser-acl copied to clipboard
Potential fix for strict mode bug
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.
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?
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.