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

[React 18.3.1] NumberFieldImpl: Support for defaultProps will be removed from memo components in a future major release. #9815

Closed
GabeDuarteM opened this issue May 2, 2024 · 1 comment · Fixed by #9832
Labels

Comments

@GabeDuarteM
Copy link

What you were expecting:
No console errors when using NumberField after updating to react 18.3.1

What happened instead:

When using react-admin with react 18.3.1, the following error gets thrown

Warning: NumberFieldImpl: Support for defaultProps will be removed from memo components in a future major release. Use JavaScript default parameters instead.

This probably comes from https://github.com/marmelab/react-admin/blob/master/packages/ra-ui-materialui/src/field/NumberField.tsx#L109-L111, and will probably break when react 19 is introduced

Steps to reproduce:

Import NumberField and use it in any page, then check the console

Related code:

Environment

  • React-admin version: 4.16.16
  • Last version that did not exhibit the issue (if applicable): -
  • React version: 18.3.1
  • Browser: Brave (but shouldn't matter)
  • Stack trace (in case of a JS error):
Warning: NumberFieldImpl: Support for defaultProps will be removed from memo components in a future major release. Use JavaScript default parameters instead.
    at td
    at https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-QHPMH4O3.js?v=0454cae4:2006:50
    at TableCell2 (https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-KYU5CILM.js?v=0454cae4:36862:17)
    at https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-4GCPQNT7.js?v=0454cae4:114618:24
    at tr
    at https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-QHPMH4O3.js?v=0454cae4:2006:50
    at TableRow2 (https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-KYU5CILM.js?v=0454cae4:37745:17)
    at RecordContextProvider (https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-4GCPQNT7.js?v=0454cae4:9557:23)
    at https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-4GCPQNT7.js?v=0454cae4:114821:24
    at tbody
    at https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-QHPMH4O3.js?v=0454cae4:2006:50
    at TableBody2 (https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-KYU5CILM.js?v=0454cae4:36737:17)
    at https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-4GCPQNT7.js?v=0454cae4:114986:23
    at table
    at https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-QHPMH4O3.js?v=0454cae4:2006:50
    at Table2 (https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-KYU5CILM.js?v=0454cae4:36643:17)
    at div
    at div
    at https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-QHPMH4O3.js?v=0454cae4:2006:50
    at DatagridContextProvider (https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-4GCPQNT7.js?v=0454cae4:115327:23)
    at https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-4GCPQNT7.js?v=0454cae4:115493:20
    at DatagridWithPreferences (https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-4GCPQNT7.js?v=0454cae4:115706:23)
    at span
    at https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-QHPMH4O3.js?v=0454cae4:2006:50
    at PreferenceKeyContextProvider (https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-4GCPQNT7.js?v=0454cae4:15316:18)
    at Configurable (https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-4GCPQNT7.js?v=0454cae4:23052:24)
    at DatagridConfigurable (https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-4GCPQNT7.js?v=0454cae4:115671:28)
    at https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-QHPMH4O3.js?v=0454cae4:2006:50
    at div
    at https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-QHPMH4O3.js?v=0454cae4:2006:50
    at Paper2 (https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-KYU5CILM.js?v=0454cae4:1754:17)
    at https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-QHPMH4O3.js?v=0454cae4:2006:50
    at Card2 (https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-KYU5CILM.js?v=0454cae4:20436:17)
    at div
    at div
    at https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-QHPMH4O3.js?v=0454cae4:2006:50
    at ListView (https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-4GCPQNT7.js?v=0454cae4:125564:20)
    at ListContextProvider (https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-4GCPQNT7.js?v=0454cae4:10729:20)
    at ResourceContextProvider (https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-4GCPQNT7.js?v=0454cae4:14519:23)
    at ListBase (https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-4GCPQNT7.js?v=0454cae4:10978:23)
    at List (https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-4GCPQNT7.js?v=0454cae4:125726:24)
    at PostListDesktop
    at PostList (https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/src/posts/PostList.tsx:361:19)
    at RenderedRoute (https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-HQCFJLUO.js?v=0454cae4:3578:5)
    at Routes (https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-HQCFJLUO.js?v=0454cae4:4081:5)
    at ResourceContextProvider (https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-4GCPQNT7.js?v=0454cae4:14519:23)
    at Resource (https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-4GCPQNT7.js?v=0454cae4:14525:23)
    at RenderedRoute (https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-HQCFJLUO.js?v=0454cae4:3578:5)
    at Routes (https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-HQCFJLUO.js?v=0454cae4:4081:5)
    at Suspense
    at ErrorBoundary2 (https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-4GCPQNT7.js?v=0454cae4:23928:35)
    at div
    at main
    at div
    at div
    at https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-QHPMH4O3.js?v=0454cae4:2006:50
    at Layout (https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-4GCPQNT7.js?v=0454cae4:24324:20)
    at default
    at div
    at RenderedRoute (https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-HQCFJLUO.js?v=0454cae4:3578:5)
    at Routes (https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-HQCFJLUO.js?v=0454cae4:4081:5)
    at CoreAdminRoutes (https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-4GCPQNT7.js?v=0454cae4:14391:3)
    at RenderedRoute (https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-HQCFJLUO.js?v=0454cae4:3578:5)
    at Routes (https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-HQCFJLUO.js?v=0454cae4:4081:5)
    at CoreAdminUI (https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-4GCPQNT7.js?v=0454cae4:14466:20)
    at div
    at https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-QHPMH4O3.js?v=0454cae4:2006:50
    at ScopedCssBaseline2 (https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-KYU5CILM.js?v=0454cae4:31124:17)
    at AdminUI (https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-4GCPQNT7.js?v=0454cae4:126300:18)
    at RtlProvider (https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-FMQ574TI.js?v=0454cae4:900:5)
    at ThemeProvider (https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-FMQ574TI.js?v=0454cae4:858:5)
    at ThemeProvider2 (https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-FMQ574TI.js?v=0454cae4:940:5)
    at ThemeProvider3 (https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-FMQ574TI.js?v=0454cae4:2719:12)
    at ThemeProvider2 (https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-4GCPQNT7.js?v=0454cae4:21672:23)
    at ResourceDefinitionContextProvider (https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-4GCPQNT7.js?v=0454cae4:14024:18)
    at NotificationContextProvider (https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-4GCPQNT7.js?v=0454cae4:5131:23)
    at I18nContextProvider (https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-4GCPQNT7.js?v=0454cae4:15274:18)
    at Router (https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-HQCFJLUO.js?v=0454cae4:4024:15)
    at HistoryRouter (https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-4GCPQNT7.js?v=0454cae4:5603:23)
    at InternalRouter (https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-4GCPQNT7.js?v=0454cae4:5643:23)
    at BasenameContextProvider (https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-4GCPQNT7.js?v=0454cae4:5623:23)
    at AdminRouter (https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-4GCPQNT7.js?v=0454cae4:5629:22)
    at QueryClientProvider2 (https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-G7FG52HX.js?v=0454cae4:2852:25)
    at PreferencesEditorContextProvider (https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-4GCPQNT7.js?v=0454cae4:13940:23)
    at StoreContextProvider (https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-4GCPQNT7.js?v=0454cae4:5037:20)
    at CoreAdminContext (https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-4GCPQNT7.js?v=0454cae4:14050:28)
    at AdminContext (https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/chunk-4GCPQNT7.js?v=0454cae4:126336:21)
    at Admin (https://githuberftms-jbcp--8080--0314a412.local-credentialless.webcontainer.io/node_modules/.vite/deps/react-admin.js?v=bba800ac:667:28)
@fzaninotto fzaninotto added the bug label May 2, 2024
@fzaninotto
Copy link
Member

Thanks, I noticed the same.

The warning has no consequence as long as you stay on React 18 (and React 19 hasn't even been published yet) so you can safely ignore it.

Yet the developer experience would be better without this noise, so we should remove it.

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

Successfully merging a pull request may close this issue.

2 participants