lastResult.deref is not a function (it is undefined)
quocluongha opened this issue · 6 comments
I updated to v5 and I encountered this error message when using createSelectorCreator
with weakMapMemoize
.
I returned a number in selectFormPosition
and this error happened, but I tried to change the returned result into object then it is working fine.
The createDeepEqualSelector
function:
export const createDeepEqualSelector = createSelectorCreator(weakMapMemoize, {
resultEqualityCheck: isEqual, // lodash isEqual
});
The state:
const initialState = {
formPosition: 0,
};
The selector functions:
export const selectWithdrawalState = (state: RootState) =>
state.shopper.profile.withdrawal;
export const selectFormPosition = createDeepEqualSelector(
selectWithdrawalState,
state => state.formPosition,
// state => ({ formPosition: state.formPosition }), <-- this is working fine
);
I will take a look at this as soon as I get a chance, in the meantime if you remove the resaultEqualityCheck
, the error should go away.
Thank you @aryaemami59, that is my temporary solution up to now.
@quocluongha Just a quick question, are you using React Native or Expo?
@aryaemami59 I am using React Native 0.72.7
@quocluongha Thank you, I'll put up a PR with the fix soon.
Fix released in v5.1.0