Skip to content

Commit

Permalink
snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
Henry8192 committed Jan 25, 2025
1 parent ae155bf commit 6647961
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/contexts/StateContextProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ const updateUrlIfEventOnPage = (
// eslint-disable-next-line max-lines-per-function, max-statements
const StateContextProvider = ({children}: StateContextProviderProps) => {
const {postPopUp} = useContext(NotificationContext);
const {filePath, logEventNum} = useContext(UrlContext);
const {filePath, isCaseSensitive, isRegex, logEventNum, queryString} = useContext(UrlContext);

// States
const [exportProgress, setExportProgress] =
Expand Down Expand Up @@ -365,6 +365,7 @@ const StateContextProvider = ({children}: StateContextProviderProps) => {
}, [postPopUp]);

const startQuery = useCallback((queryArgs: QueryArgs) => {
console.error("startQuery is triggered");
setQueryResults(STATE_DEFAULT.queryResults);
if (null === mainWorkerRef.current) {
console.error("Unexpected null mainWorkerRef.current");
Expand Down Expand Up @@ -452,6 +453,18 @@ const StateContextProvider = ({children}: StateContextProviderProps) => {
});
}, []);

useEffect(() => {
console.error(`queryString is ${queryString}`);
if (URL_SEARCH_PARAMS_DEFAULT.queryString !== queryString && URL_SEARCH_PARAMS_DEFAULT.isCaseSensitive !== isCaseSensitive && URL_SEARCH_PARAMS_DEFAULT.isRegex !== isRegex) {

Check failure on line 458 in src/contexts/StateContextProvider.tsx

View workflow job for this annotation

GitHub Actions / lint-check

This line has a length of 182. Maximum allowed is 100
startQuery({queryString, isCaseSensitive, isRegex});
}
updateWindowUrlSearchParams({
[SEARCH_PARAM_NAMES.QUERY_STRING]: URL_SEARCH_PARAMS_DEFAULT.queryString,
[SEARCH_PARAM_NAMES.IS_CASE_SENSITIVE]: URL_SEARCH_PARAMS_DEFAULT.isCaseSensitive,
[SEARCH_PARAM_NAMES.IS_REGEX]: URL_SEARCH_PARAMS_DEFAULT.isRegex,
});
}, [startQuery]);

Check failure on line 466 in src/contexts/StateContextProvider.tsx

View workflow job for this annotation

GitHub Actions / lint-check

React Hook useEffect has missing dependencies: 'isCaseSensitive', 'isRegex', and 'queryString'. Either include them or remove the dependency array

// Synchronize `logEventNumRef` with `logEventNum`.
useEffect(() => {
logEventNumRef.current = logEventNum;
Expand Down
4 changes: 4 additions & 0 deletions src/contexts/UrlContextProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@ const getWindowUrlSearchParams = () => {
);
const urlSearchParams = new URLSearchParams(window.location.search.substring(1));

urlSearchParams.forEach((value, key) => {
searchParams[key as keyof UrlSearchParams] = value;
});

if (urlSearchParams.has(SEARCH_PARAM_NAMES.FILE_PATH)) {
// Split the search string and take everything after as `filePath` value.
// This ensures any parameters following `filePath=` are incorporated into the `filePath`.
Expand Down

0 comments on commit 6647961

Please sign in to comment.