Skip to content

Commit

Permalink
Fix useEffect error (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
emilkowalski authored Mar 20, 2023
1 parent 4694553 commit cba1cea
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -408,9 +408,11 @@ const Toaster = (props: ToasterProps) => {
return;
}

// Don't batch update toasts to prevent wrong calculations
ReactDOM.flushSync(() => {
setToasts((toasts) => [toast, ...toasts]);
// Prevent batching, temp solution.
setTimeout(() => {
ReactDOM.flushSync(() => {
setToasts((toasts) => [toast, ...toasts]);
});
});
});
}, []);
Expand Down

0 comments on commit cba1cea

Please sign in to comment.