We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
While trying to troubleshoot this issue, I noticed that hmr updates seem to be triggering redundant useEffect cleanup calls.
useEffect
import { useState, useEffect } from 'preact/hooks'; export function App() { const [count, setCount] = useState(0); const inc = () => setCount((x) => x + 1); return <InnerApp count={count} inc={inc} />; } function InnerApp({ count, inc }) { useEffect(() => { console.log('Effect run'); return () => console.log('Effect cleanup'); }); return ( <div> <div>Count is: {count}</div> <button onClick={inc}>Increment</button> </div> ); }
If I click "Increment" 20 times, and then trigger an HMR update, the useEffect cleanup will run 20 (additional) times:
Sandbox: https://stackblitz.com/edit/vitejs-vite-dxlaxr?file=src%2Fapp.jsx&terminal=dev
The text was updated successfully, but these errors were encountered:
Closed by #504 and #505
Sorry, something went wrong.
Amazing — thank you! A huge boost to DX when editing on a large preact project.
Successfully merging a pull request may close this issue.
While trying to troubleshoot this issue, I noticed that hmr updates seem to be triggering redundant
useEffect
cleanup calls.If I click "Increment" 20 times, and then trigger an HMR update, the
useEffect
cleanup will run 20 (additional) times:Sandbox: https://stackblitz.com/edit/vitejs-vite-dxlaxr?file=src%2Fapp.jsx&terminal=dev
The text was updated successfully, but these errors were encountered: