From a9a5594034781ec36a367e1429c5351e5cd80f09 Mon Sep 17 00:00:00 2001 From: Thomas Osmonson Date: Mon, 10 Aug 2020 17:55:20 -0500 Subject: [PATCH] fix: side nav update on back #706 --- package.json | 2 +- src/components/side-nav.tsx | 9 ++++++--- yarn.lock | 28 ++++++++++++++-------------- 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/package.json b/package.json index 8c57d68d..3165a5f0 100755 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "lodash.debounce": "^4.0.8", "mdi-react": "7.3.0", "micro-memoize": "^4.0.9", - "next": "^9.5.2-canary.9", + "next": "^9.5.2-canary.17", "next-fonts": "^1.4.0", "next-google-fonts": "^1.1.0", "next-mdx-remote": "^0.6.0", diff --git a/src/components/side-nav.tsx b/src/components/side-nav.tsx index 8b9d79cf..029202ab 100644 --- a/src/components/side-nav.tsx +++ b/src/components/side-nav.tsx @@ -200,7 +200,7 @@ const Navigation = () => { const router = useRouter(); React.useEffect(() => { - let currentSection = selected.items; + let currentSection; if (router.pathname === '/') { currentSection = { @@ -225,8 +225,11 @@ const Navigation = () => { items: page, }; } - } else { - return router.pathname.endsWith(page.path); + } else if (!currentSection && router.pathname.endsWith(page.path)) { + currentSection = { + items: nav.sections, + type: 'default', + }; } }); }); diff --git a/yarn.lock b/yarn.lock index 96ae3779..3ac73a5f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1492,10 +1492,10 @@ resolved "https://registry.yarnpkg.com/@next/mdx/-/mdx-9.5.1.tgz#c7e2fd457810b34e8ce598f57075b799ca48751b" integrity sha512-jmNKqEMWkCPQWWeoq6CiOShngGv99Cs+rQSLlU7BZMVCZzbcTVEkAsUqR4WfLA97K2ihjtNidY5jwbKFu4h83Q== -"@next/react-dev-overlay@9.5.2-canary.16": - version "9.5.2-canary.16" - resolved "https://registry.yarnpkg.com/@next/react-dev-overlay/-/react-dev-overlay-9.5.2-canary.16.tgz#04256d5536a73ffaeea6177117fd6d3c89e8fa33" - integrity sha512-e2j9A5IrZ1+cSt/XMMV/m/GPL7B525zZr341Isut2NFA3e7vfJoxSnmkS+uPM5Xvn2lu+w9ICmH04jp3Etwpkg== +"@next/react-dev-overlay@9.5.2-canary.17": + version "9.5.2-canary.17" + resolved "https://registry.yarnpkg.com/@next/react-dev-overlay/-/react-dev-overlay-9.5.2-canary.17.tgz#f28fc8c6bcca872c4cf980ae16373d5662c262df" + integrity sha512-WIs96RTiqgmu1Z7nO7+4QE50/2EgYPFV2FVT5htj7NiuCzGD3Y43j1RZP4CjYmB+UXezAIXYsAOtiNN9r711LA== dependencies: "@babel/code-frame" "7.8.3" ally.js "1.4.1" @@ -1508,10 +1508,10 @@ stacktrace-parser "0.1.10" strip-ansi "6.0.0" -"@next/react-refresh-utils@9.5.2-canary.16": - version "9.5.2-canary.16" - resolved "https://registry.yarnpkg.com/@next/react-refresh-utils/-/react-refresh-utils-9.5.2-canary.16.tgz#22e6ed08f254cefbf6bb385d592bf05de61852f0" - integrity sha512-AWk2BTPlJHwPzAfAolLzuxvWSwV2Xxzo87ktSIjQ8800m7kYb8Mwy5opO/cR/kPUsBnMELBu/GdUBnBKu0w0+Q== +"@next/react-refresh-utils@9.5.2-canary.17": + version "9.5.2-canary.17" + resolved "https://registry.yarnpkg.com/@next/react-refresh-utils/-/react-refresh-utils-9.5.2-canary.17.tgz#1155f790092e3d0b94ef290da87d88c3d4776f8e" + integrity sha512-aWUTLcFu1ozFBX0HGvefK6ODrTAdH+aOrL7tkvfjNufzENhnGENcdxrC4rDbaBEzVgBCs9SbegGdRQaaCHmxHA== "@popperjs/core@^2.4.0": version "2.4.4" @@ -6085,10 +6085,10 @@ next-transpile-modules@^4.0.2: micromatch "^4.0.2" slash "^3.0.0" -next@^9.5.2-canary.9: - version "9.5.2-canary.16" - resolved "https://registry.yarnpkg.com/next/-/next-9.5.2-canary.16.tgz#b9d1c8d9d53c2c3ca662114d0c6cc2fda870b45e" - integrity sha512-1l6HZcehcBCTIy2ocQk8GfPpQQmean0TgC4PJcfEJ6LBMywB1/854rg2cUIKEtYLEqrX3WqFU2OEnvkLCS1z4A== +next@^9.5.2-canary.17: + version "9.5.2-canary.17" + resolved "https://registry.yarnpkg.com/next/-/next-9.5.2-canary.17.tgz#64c19478d294cd1d99d41e6ff50e0911b11657f7" + integrity sha512-QfWEM3YGAKBz85ry52pdqzzXhGOqkHAnRIKbxuS9Q6v9VJFBQoAuZjPXGEWmIgdtpvL3CdPBhFLD3YsOMblSLQ== dependencies: "@ampproject/toolbox-optimizer" "2.6.0" "@babel/code-frame" "7.8.3" @@ -6109,8 +6109,8 @@ next@^9.5.2-canary.9: "@babel/preset-typescript" "7.9.0" "@babel/runtime" "7.9.6" "@babel/types" "7.9.6" - "@next/react-dev-overlay" "9.5.2-canary.16" - "@next/react-refresh-utils" "9.5.2-canary.16" + "@next/react-dev-overlay" "9.5.2-canary.17" + "@next/react-refresh-utils" "9.5.2-canary.17" ast-types "0.13.2" babel-plugin-syntax-jsx "6.18.0" babel-plugin-transform-define "2.0.0"