Skip to content

Commit

Permalink
Merge pull request #781 from roblotter/master
Browse files Browse the repository at this point in the history
Fixes #772 Memory leak when multiple containers are used
  • Loading branch information
fkhadra committed Jul 19, 2022
2 parents 3f89543 + 7694f91 commit 8bd39a9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/hooks/useToastContainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@ export function useToastContainer(props: ToastContainerProps) {
.on(Event.ClearWaitingQueue, clearWaitingQueue)
.emit(Event.DidMount, instance);

return () => eventManager.emit(Event.WillUnmount, instance);
return () => {
toastToRender.clear();
eventManager.emit(Event.WillUnmount, instance);
};
}, []);

useEffect(() => {
Expand Down

0 comments on commit 8bd39a9

Please sign in to comment.