Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(query): Restart log queries when case-sensitivity or regex button is toggled. #130

Merged
merged 12 commits into from
Dec 9, 2024
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, {
useContext,
useRef,
useState,
} from "react";

Expand Down Expand Up @@ -44,8 +45,10 @@ const SearchTabPanel = () => {
const {queryProgress, queryResults, startQuery, uiState} = useContext(StateContext);
const [isAllExpanded, setIsAllExpanded] = useState<boolean>(true);
const [queryOptions, setQueryOptions] = useState<QUERY_OPTION[]>([]);
const queryStringRef = useRef<string>("");

const handleQueryInputChange = (ev: React.ChangeEvent<HTMLTextAreaElement>) => {
queryStringRef.current = ev.target.value;
const isCaseSensitive = queryOptions.includes(QUERY_OPTION.IS_CASE_SENSITIVE);
const isRegex = queryOptions.includes(QUERY_OPTION.IS_REGEX);
startQuery(ev.target.value, isRegex, isCaseSensitive);
Expand All @@ -55,6 +58,11 @@ const SearchTabPanel = () => {
newOptions: QUERY_OPTION[]
) => {
setQueryOptions(newOptions);
if ("" !== queryStringRef.current) {
const isCaseSensitive = newOptions.includes(QUERY_OPTION.IS_CASE_SENSITIVE);
const isRegex = newOptions.includes(QUERY_OPTION.IS_REGEX);
startQuery(queryStringRef.current, isRegex, isCaseSensitive);
}
};

return (
Expand Down