diff --git a/new-log-viewer/src/contexts/StateContextProvider.tsx b/new-log-viewer/src/contexts/StateContextProvider.tsx index bf65ca90..90c7c62a 100644 --- a/new-log-viewer/src/contexts/StateContextProvider.tsx +++ b/new-log-viewer/src/contexts/StateContextProvider.tsx @@ -186,6 +186,7 @@ const StateContextProvider = ({children}: StateContextProviderProps) => { const [fileName, setFileName] = useState(STATE_DEFAULT.fileName); const [logData, setLogData] = useState(STATE_DEFAULT.logData); const [numEvents, setNumEvents] = useState(STATE_DEFAULT.numEvents); + const [pageNum, setPageNum] = useState(STATE_DEFAULT.pageNum); const beginLineNumToLogEventNumRef = useRef(STATE_DEFAULT.beginLineNumToLogEventNum); const [exportProgress, setExportProgress] = @@ -194,7 +195,7 @@ const StateContextProvider = ({children}: StateContextProviderProps) => { // Refs const logEventNumRef = useRef(logEventNum); const numPagesRef = useRef(STATE_DEFAULT.numPages); - const pageNumRef = useRef(STATE_DEFAULT.pageNum); + const logExportManagerRef = useRef(null); const mainWorkerRef = useRef(null); @@ -220,7 +221,7 @@ const StateContextProvider = ({children}: StateContextProviderProps) => { break; case WORKER_RESP_CODE.PAGE_DATA: { setLogData(args.logs); - pageNumRef.current = args.pageNum; + setPageNum(args.pageNum) beginLineNumToLogEventNumRef.current = args.beginLineNumToLogEventNum; updateWindowUrlHashParams({ logEventNum: args.logEventNum, @@ -289,7 +290,7 @@ const StateContextProvider = ({children}: StateContextProviderProps) => { return; } - const cursor = getPageNumCursor(navAction, pageNumRef.current, numPagesRef.current); + const cursor = getPageNumCursor(navAction, pageNum, numPagesRef.current); if (null === cursor) { console.error(`Error with nav action ${navAction.code}.`); @@ -381,7 +382,7 @@ const StateContextProvider = ({children}: StateContextProviderProps) => { logData: logData, numEvents: numEvents, numPages: numPagesRef.current, - pageNum: pageNumRef.current, + pageNum: pageNum, exportLogs: exportLogs, loadFile: loadFile, diff --git a/new-log-viewer/src/services/LogFileManager/index.ts b/new-log-viewer/src/services/LogFileManager/index.ts index f7cc887b..3767c92a 100644 --- a/new-log-viewer/src/services/LogFileManager/index.ts +++ b/new-log-viewer/src/services/LogFileManager/index.ts @@ -183,7 +183,12 @@ class LogFileManager { matchingLogEventNum, } = this.#getCursorData(cursor); - const results = this.#decoder.decodeRange(pageBeginLogEventNum - 1, pageEndLogEventNum - 1, false); + const results = this.#decoder.decodeRange( + pageBeginLogEventNum - 1, + pageEndLogEventNum - 1, + false + ); + if (null === results) { throw new Error("Error occurred during decoding. " + `pageBeginLogEventNum=${pageBeginLogEventNum}, ` +