You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
v8+ documentation says "By default the strategy is equal to "ONE"."
But if some options are specified, but the strategy option is left out, it defaults to 'ALL'.
How to reproduce:
const r1 = new Navigo('/');
r1.on('/x', () => {})
r1.on('*', () => {})
r1.match('/x').length
-> result = 1
const r2 = new Navigo('/', { hash: true});
r2.on('/x', () => {})
r2.on('*', () => {})
r2.match('/x').length
-> result = 2
What I expected:
Only first route is matched, i.e. length of match array = 1
What really happened:
All matching routes are returned (length = 2)
Workaround:
explicit include "strategy: 'ONE'" in constructor.
Remark:
The culprit seems to be when options are provided, strategy remains unset if not explicitly provided.
In "matchPathToRegisteredRoutes.ts", line "if (context.resolveOptions.strategy === "ONE") {" will fail, effectively matching all routes.
At first sight, this initialisation seems unharmful for the other options, and linkselector is explicitly being checked for being unset in "findLinks()".
The text was updated successfully, but these errors were encountered:
v8+ documentation says "By default the strategy is equal to "ONE"."
But if some options are specified, but the strategy option is left out, it defaults to 'ALL'.
How to reproduce:
What I expected:
What really happened:
Workaround:
explicit include "strategy: 'ONE'" in constructor.
const r3 = new Navigo('/', { hash: true, strategy: 'ONE'});
r3.on('/x', () => {})
r3.on('*', () => {})
r3.match('/x').length
Remark:
The culprit seems to be when options are provided, strategy remains unset if not explicitly provided.
In "matchPathToRegisteredRoutes.ts", line "if (context.resolveOptions.strategy === "ONE") {" will fail, effectively matching all routes.
At first sight, this initialisation seems unharmful for the other options, and linkselector is explicitly being checked for being unset in "findLinks()".
The text was updated successfully, but these errors were encountered: