Skip to content

Commit 82e5a3e

Browse files
committed
tune notification hook
1 parent da42318 commit 82e5a3e

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/hooks/useNotification.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,15 +147,18 @@ export default function useNotification(
147147
setTaskQueue((queue) => [...queue, { type: 'destroy' }]);
148148
},
149149
}),
150-
[open],
150+
[],
151151
);
152152

153153
// ======================== Effect =========================
154+
// React 18 should all in effect that we will check container in each render
155+
// Which means getContainer should be stable.
154156
React.useEffect(() => {
155157
setContainer(getContainer());
156158
});
157159

158160
React.useEffect(() => {
161+
// Flush task when node ready
159162
if (notificationsRef.current && taskQueue.length) {
160163
taskQueue.forEach((task) => {
161164
switch (task.type) {

0 commit comments

Comments
 (0)