Fix analytics graph and toast
- Corrected analytics graph to only display budget data when budget is entered. - Fixed issue where expense toast notifications were appearing twice.
This commit is contained in:
@@ -76,9 +76,24 @@ const addToRemoveQueue = (toastId: string) => {
|
||||
export const reducer = (state: State, action: Action): State => {
|
||||
switch (action.type) {
|
||||
case "ADD_TOAST":
|
||||
// 동일한 내용의 토스트가 있으면 추가하지 않음
|
||||
if (state.toasts.some(t =>
|
||||
t.title === action.toast.title &&
|
||||
t.description === action.toast.description &&
|
||||
t.open === true
|
||||
)) {
|
||||
return state;
|
||||
}
|
||||
|
||||
// 이전 토스트 모두 닫기
|
||||
const updatedToasts = state.toasts.map(t => ({
|
||||
...t,
|
||||
open: false
|
||||
}));
|
||||
|
||||
return {
|
||||
...state,
|
||||
toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT),
|
||||
toasts: [action.toast, ...updatedToasts].slice(0, TOAST_LIMIT),
|
||||
}
|
||||
|
||||
case "UPDATE_TOAST":
|
||||
|
||||
Reference in New Issue
Block a user