Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lastResult.deref is not a function (it is undefined) #669

Closed
quocluongha opened this issue Dec 18, 2023 · 6 comments · Fixed by #671
Closed

lastResult.deref is not a function (it is undefined) #669

quocluongha opened this issue Dec 18, 2023 · 6 comments · Fixed by #671

Comments

@quocluongha
Copy link

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

);

image

@aryaemami59
Copy link
Contributor

aryaemami59 commented Dec 18, 2023

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.

@quocluongha
Copy link
Author

Thank you @aryaemami59, that is my temporary solution up to now.

@aryaemami59
Copy link
Contributor

@quocluongha Just a quick question, are you using React Native or Expo?

@quocluongha
Copy link
Author

@aryaemami59 I am using React Native 0.72.7

@aryaemami59
Copy link
Contributor

@quocluongha Thank you, I'll put up a PR with the fix soon.

@EskiMojo14
Copy link
Contributor

Fix released in v5.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants