Fix selectModal
always returning a new reference
Never use `state` as an input to `createSelector` as it is _always_ invalidated per immutability pattern.
This commit is contained in:
parent
9307511c88
commit
70a339c5d4
1 changed files with 4 additions and 9 deletions
|
@ -47,16 +47,11 @@ export const selectDaemonVersionMatched = (state) => selectState(state).daemonVe
|
||||||
export const selectVolume = (state) => selectState(state).volume;
|
export const selectVolume = (state) => selectState(state).volume;
|
||||||
export const selectMute = (state) => selectState(state).muted;
|
export const selectMute = (state) => selectState(state).muted;
|
||||||
export const selectUpgradeTimer = (state) => selectState(state).checkUpgradeTimer;
|
export const selectUpgradeTimer = (state) => selectState(state).checkUpgradeTimer;
|
||||||
|
const selectModalId = (state) => selectState(state).modal;
|
||||||
|
const selectModalProps = (state) => selectState(state).modalProps;
|
||||||
|
|
||||||
export const selectModal = createSelector(selectState, (state) => {
|
export const selectModal = createSelector(selectModalId, selectModalProps, (id, modalProps) => {
|
||||||
if (!state.modal) {
|
return id ? { id, modalProps } : null;
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
id: state.modal,
|
|
||||||
modalProps: state.modalProps,
|
|
||||||
};
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export const selectSearchOptionsExpanded = (state) => selectState(state).searchOptionsExpanded;
|
export const selectSearchOptionsExpanded = (state) => selectState(state).searchOptionsExpanded;
|
||||||
|
|
Loading…
Reference in a new issue