Skip to content

Commit

Permalink
Set default messages for no file open.
Browse files Browse the repository at this point in the history
  • Loading branch information
junhaoliao committed Sep 18, 2024
1 parent 0418f1f commit f87fc9f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions new-log-viewer/src/contexts/StateContextProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ const StateContext = createContext<StateContextType>({} as StateContextType);
*/
const STATE_DEFAULT: Readonly<StateContextType> = Object.freeze({
beginLineNumToLogEventNum: new Map<number, number>(),
fileName: "",
fileName: "No file is open.",
loadFile: () => null,
loadPage: () => null,
logData: "Loading...",
logData: "No file is open.",
numEvents: 0,
numPages: 0,
originalFileSizeInBytes: 0,
Expand Down Expand Up @@ -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});
}
Expand Down

0 comments on commit f87fc9f

Please sign in to comment.