diff --git a/new-log-viewer/src/contexts/StateContextProvider.tsx b/new-log-viewer/src/contexts/StateContextProvider.tsx index 122ccb83..4ce87391 100644 --- a/new-log-viewer/src/contexts/StateContextProvider.tsx +++ b/new-log-viewer/src/contexts/StateContextProvider.tsx @@ -193,11 +193,12 @@ const StateContextProvider = ({children}: StateContextProviderProps) => { numPagesRef.current ); - if (STATE_DEFAULT.pageNum !== pageNumRef.current) { - if (newPageNum === pageNumRef.current) { - // Don't need to switch pages so just update `logEventNum` in the URL. - updateLogEventNumInUrl(numEvents, logEventNumRef.current); - } else { + if (STATE_DEFAULT.pageNum === pageNumRef.current) { + return; + } else if (newPageNum === pageNumRef.current) { + // Don't need to switch pages so just update `logEventNum` in the URL. + updateLogEventNumInUrl(numEvents, logEventNumRef.current); + } else { // This is not the initial page load, so request a page switch. // NOTE: We don't need to call `updateLogEventNumInUrl()` since it's called when // handling the `WORKER_RESP_CODE.PAGE_DATA` response (the response to