Skip to content

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

Closed

Description

@quocluongha

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

Activity

  1. aryaemami59 commented on Dec 18, 2023

    @aryaemami59
    Member

    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.

  2. quocluongha commented on Dec 18, 2023

    @quocluongha
    Author

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

  3. aryaemami59 commented on Dec 18, 2023

    @aryaemami59
    Member

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

  4. quocluongha commented on Dec 18, 2023

    @quocluongha
    Author

    @aryaemami59 I am using React Native 0.72.7

  5. aryaemami59 commented on Dec 18, 2023

    @aryaemami59
    Member

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

  6. EskiMojo14 commented on Jan 5, 2024

    @EskiMojo14
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions