diff --git a/src/app/slices/ui.ts b/src/app/slices/ui.ts index 8907d13f..f1090a7e 100644 --- a/src/app/slices/ui.ts +++ b/src/app/slices/ui.ts @@ -3,7 +3,7 @@ import { createSlice, PayloadAction } from "@reduxjs/toolkit"; import { UploadFileData } from "@/hooks/useUploadFile"; export type ListView = "item" | "grid"; -export type SSEStatus = "connecting" | "connected" | "disconnected"; +export type SSEStatus = "connecting" | "connected" | "disconnected" | "reconnecting"; export interface UIState { SSEStatus: SSEStatus; online: boolean; @@ -46,8 +46,9 @@ const uiSlice = createSlice({ name: "ui", initialState, reducers: { - fillUI(state, action) { - return { ...initialState, ...action.payload }; + fillUI(state, action: PayloadAction>) { + const { SSEStatus, ready, online, ...rest } = action.payload; + return { ...state, ...rest }; }, setReady(state) { state.ready = true; diff --git a/src/components/StreamStatus.tsx b/src/components/StreamStatus.tsx index 72add17b..347d7b1c 100644 --- a/src/components/StreamStatus.tsx +++ b/src/components/StreamStatus.tsx @@ -1,12 +1,13 @@ import { useAppSelector } from "@/app/store"; import clsx from "clsx"; +// import { useEffect } from "react"; +// import { toast } from "react-hot-toast"; import { shallowEqual } from "react-redux"; -// import React from "react"; -type Props = {}; - -const StreamStatus = (props: Props) => { +// type Props = {}; +const StreamStatus = () => { const status = useAppSelector((store) => store.ui.SSEStatus, shallowEqual); + return (