From 3490f9820816b46e0b6c264941f746f2421843e6 Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Sun, 22 Sep 2019 16:20:26 -0700 Subject: [PATCH] fix: fix nav animation for notifications/mentions (#1515) --- src/routes/_store/observers/navObservers.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/routes/_store/observers/navObservers.js b/src/routes/_store/observers/navObservers.js index 68c11b68..a57f4387 100644 --- a/src/routes/_store/observers/navObservers.js +++ b/src/routes/_store/observers/navObservers.js @@ -3,10 +3,18 @@ import { emit } from '../../_utils/eventBus' export function navObservers (store) { function pageIsInNav (store, page) { const { navPages } = store.get() - return !!navPages.find(_ => _.name === page) + return navPages.find(_ => _.name === page) + } + + function normalizePageName (page) { + // notifications/mentions are a special case; they show as selected in the nav + return page === 'notifications/mentions' ? 'notifications' : page } store.observe('currentPage', (currentPage, previousPage) => { + currentPage = normalizePageName(currentPage) + previousPage = normalizePageName(previousPage) + if (currentPage && previousPage && pageIsInNav(store, currentPage) && pageIsInNav(store, previousPage)) {