Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[examples] Next.js + Tailwind warning: "A props object containing a "key" prop is being spread into JSX" #39966

Closed
2 tasks done
Default-01 opened this issue Nov 22, 2023 · 3 comments
Labels
examples Relating to /examples status: waiting for author Issue with insufficient information

Comments

@Default-01
Copy link

Default-01 commented Nov 22, 2023

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Steps to reproduce 🕹

  1. Install a next app with tailwind.
  2. Setup a custom theme.

Current behavior 😯

Throws a warning in the dev console:

Warning: A props object containing a "key" prop is being spread into JSX:
  let props = {key: someKey, disabled: ..., size: ..., onClick: ..., data-tag-index: ..., tabIndex: ...};
  <ForwardRef(ChipDelete) {...props} />
React keys must be passed directly to JSX without using spread:
  let props = {disabled: ..., size: ..., onClick: ..., data-tag-index: ..., tabIndex: ...};
  <ForwardRef(ChipDelete) key={someKey} {...props} />
    at Autocomplete (webpack-internal:///(app-pages-browser)/./node_modules/@mui/joy/Autocomplete/Autocomplete.js:279:69)
    at Home
    at StaticGenerationSearchParamsBailoutProvider (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/static-generation-searchparams-bailout-provider.js:15:11)
    at InnerLayoutRouter (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/layout-router.js:241:11)
    at RedirectErrorBoundary (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/redirect-boundary.js:72:9)
    at RedirectBoundary (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/redirect-boundary.js:80:11)
    at NotFoundErrorBoundary (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/not-found-boundary.js:54:9)
    at NotFoundBoundary (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/not-found-boundary.js:62:11)
    at LoadingBoundary (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/layout-router.js:338:11)
    at ErrorBoundary (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/error-boundary.js:110:11)
    at InnerScrollAndFocusHandler (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/layout-router.js:152:9)
    at ScrollAndFocusHandler (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/layout-router.js:227:11)
    at RenderFromTemplateContext (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/render-from-template-context.js:15:44)
    at OuterLayoutRouter (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/layout-router.js:348:11)
    at f (webpack-internal:///(app-pages-browser)/./node_modules/next-themes/dist/index.module.js:8:597)
    at $ (webpack-internal:///(app-pages-browser)/./node_modules/next-themes/dist/index.module.js:8:348)
    at ThemeProvider (webpack-internal:///(app-pages-browser)/./components/Theme/ThemeProvider.tsx:10:11)
    at body
    at html
    at RedirectErrorBoundary (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/redirect-boundary.js:72:9)
    at RedirectBoundary (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/redirect-boundary.js:80:11)
    at NotFoundErrorBoundary (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/not-found-boundary.js:54:9)
    at NotFoundBoundary (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/not-found-boundary.js:62:11)
    at DevRootNotFoundBoundary (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/dev-root-not-found-boundary.js:32:11)
    at ReactDevOverlay (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/react-dev-overlay/internal/ReactDevOverlay.js:66:9)
    at HotReload (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/react-dev-overlay/hot-reloader-client.js:294:11)
    at Router (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/app-router.js:157:11)
    at ErrorBoundaryHandler (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/error-boundary.js:82:9)
    at ErrorBoundary (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/error-boundary.js:110:11)
    at AppRouter (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/app-router.js:440:13)
    at ServerRoot (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/app-index.js:126:11)
    at RSCComponent
    at Root (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/app-index.js:142:11)

Expected behavior 🤔

No warning

Context 🔦

No response

Your environment 🌎

System:
OS: Windows 11 10.0.22631
Binaries:
Node: 16.16.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
npm: 9.1.2 - C:\Program Files\nodejs\npm.CMD
Browsers:
Chrome: Not Found
Edge: Chromium (119.0.2151.72

I use chrome

@Default-01 Default-01 added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Nov 22, 2023
@mj12albert
Copy link
Member

mj12albert commented Nov 23, 2023

@Default-01 Please provide a repro - looks like you are using Next.js and Joy UI, you can fork this template: https://codesandbox.io/p/devbox/joy-ui-next-js-app-router-mcve-jh57h6

@mj12albert mj12albert added status: waiting for author Issue with insufficient information and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Nov 23, 2023
@mj12albert
Copy link
Member

Possible duplicate of #39474

@danilo-leal danilo-leal changed the title app-index.js:31 Warning: A props object containing a "key" prop is being spread into JSX [examples] Next.js + Tailwind warning: "A props object containing a "key" prop is being spread into JSX" Nov 23, 2023
@danilo-leal danilo-leal added the examples Relating to /examples label Nov 23, 2023
Copy link

Since the issue is missing key information and has been inactive for 7 days, it has been automatically closed. If you wish to see the issue reopened, please provide the missing information.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
examples Relating to /examples status: waiting for author Issue with insufficient information
Projects
None yet
Development

No branches or pull requests

3 participants