From dba036c6b300889cccae9c74c1354739185b08ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mose=20M=C3=BCller?= Date: Tue, 5 Mar 2024 13:19:02 +0100 Subject: [PATCH] do not try to update state if it is not yet set This happens when the backend pushes updates before the frontend has received and set the state when loading the page, first. --- frontend/src/App.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 6a509a1..3f71287 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -32,6 +32,9 @@ const reducer = (state: State, action: Action): State => { case 'SET_DATA': return action.data; case 'UPDATE_ATTRIBUTE': { + if (state === null) { + return null; + } return { ...state, value: setNestedValueByPath(state.value, action.fullAccessPath, action.newValue)