-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
[RFR] Convert PaginationActions to hooks #3598
Conversation
…ent from recompose/pure
); | ||
|
||
export default enhance(PaginationActions); | ||
export default PaginationActions; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should wrap this component with React.memo
(basically the same as pure
)
); | ||
|
||
export default enhance(PaginationActions); | ||
export default React.memo(PaginationActions, () => true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're preventing this component to rerender when its props change. Please don't override the isEqual function (that's what pure
does).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
import ChevronLeft from '@material-ui/icons/ChevronLeft'; | ||
import ChevronRight from '@material-ui/icons/ChevronRight'; | ||
import compose from 'recompose/compose'; | ||
import { translate } from 'ra-core'; | ||
import { useTranslate } from 'react-admin'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be ra-core
Convert
PaginationActions
to hooks.This was mostly straightforward conversion done step-by-step (running
make test-unit
at every step). One note though... I removed the HOCrecompose/pure
along with the non-default export. Using the pure-wrapped component does not pass thePaginationActions.spec
. Let me know if I got this wrong.