-
Notifications
You must be signed in to change notification settings - Fork 279
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: do not clear dialog state immediately on useDialog unmount (#2584)
### 🎯 Goal When the `useDialog` hook's component unmounts, it immediately clears dialog state in an effect cleanup. However, in some situations an effect cleanup can run even if the hook's component is still mounted and effect's dependencies didn't change - e.g., when `<StrictMode />` is enabled. So it's safer to keep dialog state for a short time after cleanup runs. ### 🛠 Implementation details Instead of immediately removing dialog state, it's marked to be removed after a short timeout. Referencing the dialog again quick cancels state removal. Fixes #2583.
- Loading branch information
1 parent
56def19
commit a8755ec
Showing
7 changed files
with
113 additions
and
1,463 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
import { StrictMode } from 'react'; | ||
import ReactDOM from 'react-dom/client'; | ||
import App from './App.tsx'; | ||
import './index.scss'; | ||
|
||
ReactDOM.createRoot(document.getElementById('root')!).render(<App />); | ||
ReactDOM.createRoot(document.getElementById('root')!).render( | ||
<StrictMode> | ||
<App /> | ||
</StrictMode>, | ||
); |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters