-
-
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
[WIP] makeStyles and functional components #3461
Conversation
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.
Cool :) I think you don't have to use createStyles
when you use makeStyles
(see https://material-ui.com/styles/basics/#hook-api)
Ah! The tests are failing because with the This is no longer the case now with the hook. |
Even better, if you feel up for it, convert them to |
sorry @djhi i don't think i can do this i'm not very good with testing |
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.
i need feedback on this if it's good i will continue converting the others to functional components
also how should i handle components with shouldComponentUpdate
This looks very good to me. You can use |
No, See https://reactjs.org/docs/hooks-rules.html#only-call-hooks-from-react-functions |
My bad! Seems like we can't. So, about your question, you can use |
@djhi some components are class based while they dot use any lifecycle methods or internal state like ra-tree-ui-materialui/TreeNodeContent should i convert them too ? and could you give savebutton tests a look |
If you feel like you can convert them, else you don't have to. |
It's fine by me i would love to help this awesome project whenever i can |
Don't feel obligated to migrate all the components at once! This one tend to be huge, and a split might be a good idea IMHO. |
@MohammedFaragallah please fix the tests before converting more components. We can't merge this PRs if it breaks the tests. |
@Kmaschta yes i won't be converting any more components this status list is for the maintainers to keep track whats almost done, but i'll focus on getting tests fixed as @fzaninotto asked, sorry for the delay but i'm really busy this days and my lack of experience with testing isn't helping very soon all will be resolved i hope |
@MohammedFaragallah I'm going to change all inputs for react-final-form migration. I will update them to use |
@djhi , What to do in case of |
Thanks a lot for your effort, but your work isn't going to be merged soon, because of the rebases and failed tests. I'm going to close this, and I recommend that you cherry-pick the commits to open smaller PRs, migrating a handful of components only (less than a dozen), and making sure the tests pass. I'll do the same for your other PR. |
Refs #3453
current status
examples/demo/src/layout/Login.js
ra-input-rich-text/src/index.js
ra-tree-ui-materialui/src/DragLayer.js
ra-tree-ui-materialui/src/DragPreview.js
ra-tree-ui-materialui/src/NodeActions.js
ra-tree-ui-materialui/src/NodeForm.js
ra-tree-ui-materialui/src/NodeView.js
ra-tree-ui-materialui/src/RootDropTarget.js
ra-tree-ui-materialui/src/Tree.js
ra-tree-ui-materialui/src/TreeNode.js
ra-ui-materialui/src/Link.tsx
ra-ui-materialui/src/auth/Login.tsx
ra-ui-materialui/src/auth/LoginForm.tsx
ra-ui-materialui/src/button/CreateButton.js
ra-ui-materialui/src/button/SaveButton.js
ra-ui-materialui/src/field/BooleanField.tsx
ra-ui-materialui/src/field/ChipField.tsx
ra-ui-materialui/src/field/FileField.tsx
ra-ui-materialui/src/field/ImageField.tsx
ra-ui-materialui/src/form/FormInput.js
ra-ui-materialui/src/form/SimpleFormIterator.js
ra-ui-materialui/src/form/TabbedForm.js
ra-ui-materialui/src/form/Toolbar.js
ra-ui-materialui/src/input/AutocompleteArrayInput.js
ra-ui-materialui/src/input/AutocompleteArrayInputChip.js
ra-ui-materialui/src/input/AutocompleteInput.js
ra-ui-materialui/src/input/CheckboxGroupInput.js
ra-ui-materialui/src/input/FileInput.js
ra-ui-materialui/src/input/FileInputPreview.js
ra-ui-materialui/src/input/ImageInput.js
ra-ui-materialui/src/input/Labeled.js
ra-ui-materialui/src/input/NullableBooleanInput.js
ra-ui-materialui/src/input/RadioButtonGroupInput.js
ra-ui-materialui/src/input/ResettableTextField.js
ra-ui-materialui/src/input/SearchInput.js
ra-ui-materialui/src/input/SelectArrayInput.js
ra-ui-materialui/src/input/SelectInput.js
ra-ui-materialui/src/layout/AppBar.js
ra-ui-materialui/src/layout/CardContentInner.js
ra-ui-materialui/src/layout/Confirm.js
ra-ui-materialui/src/layout/Error.js
ra-ui-materialui/src/layout/Layout.js
ra-ui-materialui/src/layout/LinearProgress.js
ra-ui-materialui/src/layout/Loading.js
ra-ui-materialui/src/layout/LoadingIndicator.js
ra-ui-materialui/src/layout/Menu.js
ra-ui-materialui/src/layout/MenuItemLink.js
ra-ui-materialui/src/layout/NotFound.js
ra-ui-materialui/src/layout/Notification.js
ra-ui-materialui/src/layout/Sidebar.js
ra-ui-materialui/src/list/BulkActions.js
ra-ui-materialui/src/list/BulkActionsToolbar.js
ra-ui-materialui/src/list/Datagrid.js
ra-ui-materialui/src/list/DatagridHeaderCell.js
ra-ui-materialui/src/list/DatagridLoading.js
ra-ui-materialui/src/list/Filter.js
ra-ui-materialui/src/list/FilterButton.js
ra-ui-materialui/src/list/FilterForm.js
ra-ui-materialui/src/list/PaginationActions.js
ra-ui-materialui/src/list/SimpleList.js
ra-ui-materialui/src/list/SingleFieldList.js
And then there is the doc:
CreateEdit.md
Fields.md
List.md
Theming.md
Tutorial.md