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

Preact 10.20 + @mui/x-data-grid v7 causes datagrid to appear multiple times in dev-mode, but not in preview-mode #4344

Open
1 task done
vsacom opened this issue Apr 19, 2024 · 1 comment
Labels

Comments

@vsacom
Copy link

vsacom commented Apr 19, 2024

  • Check if updating to the latest Preact version resolves the issue
    Using version: 10.20.2

Describe the bug

Environment: Preact 10.20.2 + Typescript 5.4.5 + Vite 5.2.9 + @mui/x-data-grid 7.2.0.

Using vite+preact in development mode, the x-data-grid appears multiple times on the page.
With the same setup, running vite --preview, the x-data-grid appears once as expected.

Bug report has been opened at @mui/mui-x, where maintainer has requested to open ticket here. Link to ticket: mui/mui-x#12829

To Reproduce

Codesandbox: https://codesandbox.io/p/devbox/datagridpro-test-7-2-0-47rlrc

Sample source code based on the codesandbox:
datagrid_720_preact.zip

With the sample source code, run:

  1. npm install
  2. npm run dev -> The output should have just one datagrid, but has multiple overlapping.
  3. npm run preview --> The output appears as expected.

Expected behavior
The datagrid should appear just once

@rschristian
Copy link
Member

rschristian commented Apr 19, 2024

Looks to be using NaN in a dependency array, might be related to #3954


Edit: Can confirm, preact/debug (correctly) throws an error upon encountering this, as it is not a valid usage at the moment (NaN != NaN, and we don't handle this).

Couple options to unblock you:

  • More work, but strip out the error from preact/debug, specifically this block. You'll need to edit/patch the built (and minified) files, but this shouldn't be too hard to do.
  • Disable preact/debug by disabling devToolsEnabled in your vite.config.js, i.e., preact({ devToolsEnabled: false }). This will disable all debug warnings & errors, so I'm not sure I'd recommend it.

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

No branches or pull requests

2 participants