refactor: stop SSE before start connect

This commit is contained in:
Tristan Yang
2024-05-14 17:58:40 +08:00
parent 96363f1e15
commit 78e651123a
10 changed files with 397 additions and 366 deletions
+4 -3
View File
@@ -4,11 +4,12 @@ import { UploadFileData } from "@/hooks/useUploadFile";
export type ListView = "item" | "grid";
export type SSEStatus = "connecting" | "connected" | "disconnected" | "reconnecting";
export type InputMode = "text" | "markdown";
export interface UIState {
SSEStatus: SSEStatus;
online: boolean;
ready: boolean;
inputMode: "text";
inputMode: InputMode;
menuExpand: boolean;
// todo
fileListView: ListView;
@@ -62,10 +63,10 @@ const uiSlice = createSlice({
toggleMenuExpand(state) {
state.menuExpand = !state.menuExpand;
},
updateInputMode(state, action) {
updateInputMode(state, action: PayloadAction<InputMode>) {
state.inputMode = action.payload;
},
updateFileListView(state, action) {
updateFileListView(state, action: PayloadAction<ListView>) {
state.fileListView = action.payload;
},
updateRememberedNavs(