From c39498272bf2d7db25ad6e5265dd8f920184b2ef Mon Sep 17 00:00:00 2001 From: Jonas Gilg Date: Fri, 24 Feb 2023 11:11:34 +0100 Subject: [PATCH 1/2] :beetle: Fix group filter update issue. --- frontend/src/components/ManageGroupDialog.tsx | 2 +- frontend/src/store/DataSelectionSlice.ts | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/ManageGroupDialog.tsx b/frontend/src/components/ManageGroupDialog.tsx index 47558da9..20973a77 100644 --- a/frontend/src/components/ManageGroupDialog.tsx +++ b/frontend/src/components/ManageGroupDialog.tsx @@ -87,7 +87,7 @@ export function ManageGroupDialog(props: {onCloseRequest: () => void}): JSX.Elem padding: theme.spacing(2), }} > - {Object.values(groupFilterList)?.map((item) => ( + {Object.values(groupFilterList || {})?.map((item) => ( ; + groupFilters: Dictionary | null; } const initialState: DataSelection = { @@ -101,12 +106,24 @@ export const DataSelectionSlice = createSlice({ state.compartmentsExpanded = !state.compartmentsExpanded; }, setGroupFilter(state, action: PayloadAction) { + if (!state.groupFilters) { + state.groupFilters = {}; + } + state.groupFilters[action.payload.id] = action.payload; }, deleteGroupFilter(state, action: PayloadAction) { + if (!state.groupFilters) { + state.groupFilters = {}; + } + delete state.groupFilters[action.payload]; }, toggleGroupFilter(state, action: PayloadAction) { + if (!state.groupFilters) { + state.groupFilters = {}; + } + if (state.groupFilters[action.payload]) { state.groupFilters[action.payload].isVisible = !state.groupFilters[action.payload].isVisible; } From e4d4d27bc5ba91a338eff499cec4b716da8e9206 Mon Sep 17 00:00:00 2001 From: Jonas Gilg Date: Fri, 24 Feb 2023 11:18:31 +0100 Subject: [PATCH 2/2] :memo: Add changelog entry. --- docs/changelog.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/changelog.md b/docs/changelog.md index 9d4403bd..12cf495f 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -12,13 +12,15 @@ - Example of a group filter: "All males of any age" - The scenario cards now show the active group filters as an collapsible addon to the right. - The line chart displays the group filters with a different line style. - + ### Improvements - All numbers on scenario cards now show as integers only. - The cards are now bigger, so it is less likely for text to overflow. - The app now saves, if the compartments were expanded between sessions. ### Bug fixes +- Found an issue with the persistent cache that crashed the website when a new property is added to the persistent store + and added a comment to prevent future errors. ---