-
Notifications
You must be signed in to change notification settings - Fork 200
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
Fixed error related to Router only returning the FIRST of many potential matches rather than the correct one. #6
base: master
Are you sure you want to change the base?
Conversation
…l match rather than just returning the first match, thereby ensuring matches that are merely a subset of the provided path are not erroneously returned as they were previously. Also added and wired up a new Route and corresponding View (PostViewCategories) to test the new routing logic.
Thanks for this suggestion. Sorry it took me over a year to reply to this PR. I like it but can you please remove the PostViewCategories view because it's not part of the video. |
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 didn't look at the code and files for the PostViewCategories because the author of this repo doesn't want to merge those files anyway.
}; | ||
}); | ||
|
||
let match = potentialMatches.find(potentialMatch => potentialMatch.result !== null); | ||
|
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.
A (unnecessary) empty line. 😉
|
||
}) | ||
|
||
|
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.
There is also an unnecessarily empty lines here.
var match | ||
potentialMatches.forEach(entry =>{ | ||
|
||
if(entry.result != null) { | ||
|
||
match = (match === undefined || entry.route.path.length > match.route.path.length) ? entry : match | ||
} | ||
|
||
}) |
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.
This one should be looked at again more closely.
In addition to an =
at the beginning, a semicolon is also missing at the end too.
There are also unnecessary empty lines here, again that can be removed.
Modified routing logic to match against the longest possible potential match rather than just returning the first match, thereby ensuring matches that are merely a subset of the provided path are not erroneously returned as they were previously. Also added and wired up a new Route and corresponding View (PostViewCategories) to test the new routing logic.