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

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

Closed
godlike0108 opened this issue Mar 7, 2019 · 1 comment

Comments

@godlike0108
Copy link

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):
@fzaninotto
Copy link
Member

No, it's not intended. Feel free to submit a PR to change it.

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

No branches or pull requests

2 participants