From 0f10a972cf86d5dc3ca73a48d0acec53c8a66905 Mon Sep 17 00:00:00 2001 From: Alex Soloviev Date: Thu, 28 Nov 2024 13:10:22 -0700 Subject: [PATCH] fix results page on language toggle --- pages/results/index.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pages/results/index.tsx b/pages/results/index.tsx index a017d13a..b234d683 100644 --- a/pages/results/index.tsx +++ b/pages/results/index.tsx @@ -31,7 +31,7 @@ const ResultsPage = dynamic( const Results: NextPage<{ adobeAnalyticsUrl: string }> = ({ adobeAnalyticsUrl, }) => { - const [inputs, setInputs]: [ + const [_inputs, setInputs]: [ FieldInputsObject, (value: FieldInputsObject) => void ] = useSessionStorage('inputs', {}) @@ -43,7 +43,7 @@ const Results: NextPage<{ adobeAnalyticsUrl: string }> = ({ const [response, setResponse]: [any, (value: any) => void] = useSessionStorage('calculationResults', {}) - const [savedInputs, setSavedInputs]: [any, (value: any) => void] = + const [savedInputs, _setSavedInputs]: [any, (value: any) => void] = useSessionStorage('resultPageInputs', {}) const inputHelper = new InputHelper( @@ -61,6 +61,12 @@ const Results: NextPage<{ adobeAnalyticsUrl: string }> = ({ } }, []) // eslint-disable-line react-hooks/exhaustive-deps + useEffect(() => { + const mainHandler = new MainHandler(inputHelper.asObjectWithLanguage) + const response: ResponseSuccess | ResponseError = mainHandler.results + setResponse(response) + }, [language]) + return ( <>