Skip to content

Commit

Permalink
Add comment when lastMatch should depend on isExact
Browse files Browse the repository at this point in the history
  • Loading branch information
supasate committed Mar 15, 2020
1 parent 444681f commit d2f0bb0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/selectors.js
Expand Up @@ -32,7 +32,13 @@ const createSelectors = (structure) => {
}
lastPathname = pathname
const match = matchPath(pathname, path)
if (!match || !lastMatch || match.url !== lastMatch.url || match.isExact !== lastMatch.isExact) {
if (
!match
|| !lastMatch
|| match.url !== lastMatch.url
// When URL matched for nested routes, URL is the same but isExact is not.
|| match.isExact !== lastMatch.isExact
) {
lastMatch = match
}

Expand Down

0 comments on commit d2f0bb0

Please sign in to comment.