Skip to content

The loose equality written in ra-ui-materialui/src/layout/Menu.js line 102-103 is intended? #2970

Description

@godlike0108

What you were expecting:

In react-admin/packages/ra-ui-materialui/src/layout/Menu.js, line 102~103,
there exists a loose equality for path comparison, in common case we use strict equality more.

What happened instead:

It cause linting notice while I try to use fork Menu.js out and use it.

Steps to reproduce:

Just fork the Menu.js out, import it and run the code
Related code:

const enhance = compose(
    translate,
    connect(
        mapStateToProps,
        {}, // Avoid connect passing dispatch in props,
        null,
        {
            areStatePropsEqual: (prev, next) =>
                prev.resources.every(
                    (value, index) => value === next.resources[index] // shallow compare resources
                ) &&
                prev.pathname == next.pathname &&
                prev.open == next.open,
        }
    ),
    withStyles(styles)
);

Other information:

I just want to know, is the loose equality here intended to prevent some issue or not?
if I swap the loose equality here to strict equality, will it break the code or lose some functionality?

Environment

  • React-admin version: 2.5.0
  • Last version that did not exhibit the issue (if applicable):
  • React version:
  • Browser:
  • Stack trace (in case of a JS error):

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions