From d2f0bb088a12ef5e07eeeeb3a1fa0ed23deef094 Mon Sep 17 00:00:00 2001 From: Ping Supasate Choochaisri Date: Sat, 14 Mar 2020 21:33:01 -0400 Subject: [PATCH] Add comment when lastMatch should depend on isExact --- src/selectors.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/selectors.js b/src/selectors.js index 15f7eff1..968e4524 100644 --- a/src/selectors.js +++ b/src/selectors.js @@ -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 }