diff --git a/ts/store/reducers/debug.ts b/ts/store/reducers/debug.ts index 79b127ba1ac..5153d1837e6 100644 --- a/ts/store/reducers/debug.ts +++ b/ts/store/reducers/debug.ts @@ -1,5 +1,6 @@ import AsyncStorage from "@react-native-async-storage/async-storage"; import { PersistConfig, PersistPartial, persistReducer } from "redux-persist"; +import { createSelector } from "reselect"; import { getType } from "typesafe-actions"; import { resetDebugData, @@ -73,4 +74,15 @@ export const debugPersistor = persistReducer( // Selector export const isDebugModeEnabledSelector = (state: GlobalState) => state.debug.isDebugModeEnabled; -export const debugDataSelector = (state: GlobalState) => state.debug.debugData; + +/** + * Selector that returns the debug data without the undefined values + * avoiding to display empty values in the DebugInfoOverlay + */ +export const debugDataSelector = createSelector( + (state: GlobalState) => state.debug.debugData, + debugData => + Object.fromEntries( + Object.entries(debugData).filter(([_, value]) => value !== undefined) + ) +);