From f87fc9fe986cb8211a5c395a66b6dee038c8506a Mon Sep 17 00:00:00 2001 From: Junhao Liao Date: Wed, 18 Sep 2024 15:37:06 -0400 Subject: [PATCH] Set default messages for no file open. --- new-log-viewer/src/contexts/StateContextProvider.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/new-log-viewer/src/contexts/StateContextProvider.tsx b/new-log-viewer/src/contexts/StateContextProvider.tsx index 4ad1e609..c66b8394 100644 --- a/new-log-viewer/src/contexts/StateContextProvider.tsx +++ b/new-log-viewer/src/contexts/StateContextProvider.tsx @@ -52,10 +52,10 @@ const StateContext = createContext({} as StateContextType); */ const STATE_DEFAULT: Readonly = Object.freeze({ beginLineNumToLogEventNum: new Map(), - fileName: "", + fileName: "No file is open.", loadFile: () => null, loadPage: () => null, - logData: "Loading...", + logData: "No file is open.", numEvents: 0, numPages: 0, originalFileSizeInBytes: 0, @@ -174,6 +174,8 @@ const StateContextProvider = ({children}: StateContextProviderProps) => { }, []); const loadFile = useCallback((fileSrc: FileSrcType, cursor: CursorType) => { + setFileName("Loading..."); + setLogData("Loading..."); if ("string" !== typeof fileSrc) { updateWindowUrlSearchParams({[SEARCH_PARAM_NAMES.FILE_PATH]: null}); }