I've got a component that subscribes to a portion of the store and triggers an effect after
const Component = (name) => {
const query = useSelector((state) => getQuerySelector(state, name), shallowEqual);
useEffect(() => {
doStuff();
}, [query]);
}
The selector looks like
const getQuerySelector = (state, name) => state.innerReducer[name].query;
Even if when the reducer updates the query with the same value like {value: true} (it's a result of a computation of other values) the selector seems to be updated every time. This is part of my reducer:
case 'ACTION_X':
const query = {aProp: aValue, someOtherProp: someValue}
return {
...otherData,
query
}
I tried to memoize the selector with createSelector as well, but with no luck.