Skip to content

Commit

Permalink
chore: avoid to show undefined debug data in debug info overlay
Browse files Browse the repository at this point in the history
  • Loading branch information
mastro993 committed Dec 17, 2024
1 parent d5defad commit dcc41ad
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion ts/store/reducers/debug.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -73,4 +74,15 @@ export const debugPersistor = persistReducer<DebugState, Action>(
// 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)
)
);

0 comments on commit dcc41ad

Please sign in to comment.