Skip to content

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

Open

Description

@Avishayy

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!

Activity

  1. changed the title [-]How to redux-orm falsely triggering state change?[/-] [+]How to debug redux-orm falsely triggering state change?[/+] on Oct 7, 2021
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