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

use @vite/plugin-react build, sometime useEffect hook cleanup does not work. #29

Closed
7 tasks done
xukechu opened this issue Oct 28, 2022 · 1 comment
Closed
7 tasks done

Comments

@xukechu
Copy link

xukechu commented Oct 28, 2022

Describe the bug

when I use @vite/plugin-react build project, I impot antd Form component in my project, when run "dist" in my server, deps is empty array useEffect cleanup is not work.

I find reason, because @vite/plugin-react default use 'jsxruntime', when set this options {jsxRuntime: 'classic'}, the cleanup is on work!

Reproduction

https://codesandbox.io/p/sandbox/sleepy-hodgkin-lpc40v?file=%2Fvite.config.ts&selection=%5B%7B%22endColumn%22%3A8%2C%22endLineNumber%22%3A11%2C%22startColumn%22%3A8%2C%22startLineNumber%22%3A11%7D%5D&workspace=%257B%2522activeFileId%2522%253A%2522cl95khku20012luip4301gyja%2522%252C%2522openFiles%2522%253A%255B%2522%252FREADME.md%2522%252C%2522%252Fpackage.json%2522%252C%2522%252Fsrc%252Fmain.tsx%2522%252C%2522%252Fsrc%252FApp.tsx%2522%252C%2522%252Fvite.config.ts%2522%255D%252C%2522sidebarPanel%2522%253A%2522EXPLORER%2522%252C%2522gitSidebarPanel%2522%253A%2522COMMIT%2522%252C%2522sidekickItems%2522%253A%255B%257B%2522type%2522%253A%2522PREVIEW%2522%252C%2522taskId%2522%253A%2522dev%2522%252C%2522port%2522%253A5173%252C%2522key%2522%253A%2522cl9s933rs000k306is9uxb2yb%2522%252C%2522isMinimized%2522%253Afalse%257D%255D%257D

Steps to reproduce

No response

System Info

System:
    OS: Windows 10 10.0.22000
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i5-11320H @ 3.20GHz
    Memory: 1.24 GB / 15.74 GB
  Binaries:
    Node: 16.13.1 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.17 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 8.1.2 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.22000.120.0), Chromium (106.0.1370.52)
    Internet Explorer: 11.0.22000.120
  npmPackages:
    @vitejs/plugin-legacy: ^2.3.0 => 2.3.0
    @vitejs/plugin-react: ^2.2.0 => 2.2.0
    vite: ^3.2.0 => 3.2.0

Used Package Manager

yarn

Logs

No response

Validations

@patak-dev patak-dev transferred this issue from vitejs/vite Dec 3, 2022
@ArnaudBarre
Copy link
Member

Hey just tested inside codesanbox and the reset button is working in both case from my testing.

If you think there is an issue with useEffect in automatic runtime, this is either an issue with the lib (most probably) or with React (very low given the size of FB internal codebase).

While there is a very small chance a an error introduce by a minification issue, I think more people would have encounter it in the last months, so I'm closing for now. If you think this is the case, please provide an updated example on Stackblitz (can't download project on codesandbox 😕)

@github-actions github-actions bot locked and limited conversation to collaborators Feb 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants