From 8145619f285c5793d69c830bdf21b250f50097e7 Mon Sep 17 00:00:00 2001 From: Lisa Hillebrand Date: Sun, 13 Dec 2020 16:16:11 +0100 Subject: [PATCH] Fix error occurring when navigating back from settings section --- slices/navigation.js | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/slices/navigation.js b/slices/navigation.js index 89a442c..306a107 100644 --- a/slices/navigation.js +++ b/slices/navigation.js @@ -1,5 +1,5 @@ import { createSlice } from 'redux-starter-kit' -import { pages, isSymptomView } from '../components/pages' +import { pages } from '../components/pages' const navigationSlice = createSlice({ slice: 'navigation', @@ -14,22 +14,19 @@ const navigationSlice = createSlice({ } }, goBack: ({ currentPage, previousPage }) => { - - if (currentPage === 'CycleDay' || isSymptomView(currentPage)) { - if (previousPage) { - return { - currentPage: previousPage - } + if (currentPage === 'CycleDay' && !!previousPage) { + return { + currentPage: previousPage, } } - const page = pages.find(p => p.component === currentPage) + const page = pages.find((p) => p.component === currentPage) return { currentPage: page.parent, previousPage: currentPage, } - } - } + }, + }, }) // Extract the action creators object and the reducer