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

How to debug redux-orm falsely triggering state change? #778

Open
Avishayy opened this issue Oct 7, 2021 · 0 comments
Open

How to debug redux-orm falsely triggering state change? #778

Avishayy opened this issue Oct 7, 2021 · 0 comments

Comments

@Avishayy
Copy link

Avishayy commented Oct 7, 2021

Hey, I have a medium-sized codebase that has around 12 ORM reducers (registered with createReducer) and around 5-6 regular ones. All reducers are merged with combineReducers and I have a periodic action that dispatches every 5 second.

Here's the selector:

export const itemSelector = (state: any, itemUuidList: Array<Uuid>) => {
  console.trace();
  let selector = createSelector(orm.Item,
    (item) => 
      [0]
    );

  return selector(state, itemUuidList);
}

The real selector is slightly different, but this reproducer is still non-working. I changed the selector to return [0] unconditionally because this value is not getting cached.

The periodic action is not related to the ORM, these will return undefined for that but for some reason the selector above will return a new object (inferring that orm.Item was changed?) and my component will re-render.

I tried to debug but I can't figure out what in redux-orm causes react to act as the model was changed (when it was not, the ORM reducers did nothing).

I'll appreciate any help, thank you!

@Avishayy Avishayy changed the title How to redux-orm falsely triggering state change? How to debug redux-orm falsely triggering state change? Oct 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant