Skip to content

Commit 2e1129c

Browse files
committed
Fix endless loop when height updates
1 parent c3d6739 commit 2e1129c

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/core/store.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,18 @@ export const reducer = (state: State, action: Action): State => {
6060
return {
6161
...state,
6262
toasts: state.toasts.map((t) =>
63-
t.id === action.toast.id
64-
? { ...t, dismissed: false, visible: true, ...action.toast }
65-
: t
63+
t.id === action.toast.id ? { ...t, ...action.toast } : t
6664
),
6765
};
6866

6967
case ActionType.UPSERT_TOAST:
7068
const { toast } = action;
71-
return state.toasts.find((t) => t.id === toast.id)
72-
? reducer(state, { type: ActionType.UPDATE_TOAST, toast })
73-
: reducer(state, { type: ActionType.ADD_TOAST, toast });
69+
return reducer(state, {
70+
type: state.toasts.find((t) => t.id === toast.id)
71+
? ActionType.UPDATE_TOAST
72+
: ActionType.ADD_TOAST,
73+
toast,
74+
});
7475

7576
case ActionType.DISMISS_TOAST:
7677
const { toastId } = action;

0 commit comments

Comments
 (0)