Skip to content

fix(webui): Respect case sensitivity setting in search queries (fixes #1060); refactor Zustand usages.#1063

Merged
davemarco merged 7 commits into
y-scope:mainfrom
davemarco:case
Jul 3, 2025
Merged

fix(webui): Respect case sensitivity setting in search queries (fixes #1060); refactor Zustand usages.#1063
davemarco merged 7 commits into
y-scope:mainfrom
davemarco:case

Conversation

@davemarco

@davemarco davemarco commented Jul 2, 2025

Copy link
Copy Markdown
Contributor

Description

Case sensitivity option was submitted as part of query, this PR adds missing option.

I also did some minor refactoring per new zustand guidelines in affected files

Checklist

  • The PR satisfies the contribution guidelines.
  • This is a breaking change and that has been indicated in the PR title, OR this isn't a
    breaking change.
  • Necessary docs have been updated, OR no docs need to be updated.

Validation performed

Tested case sensitivity toggle works

Summary by CodeRabbit

  • Refactor
    • Enhanced search controls and results timeline to dynamically respect case sensitivity settings, improving search precision while maintaining the existing user interface.

Marco added 2 commits July 2, 2025 19:41
@davemarco davemarco requested a review from a team as a code owner July 2, 2025 19:47
@coderabbitai

coderabbitai Bot commented Jul 2, 2025

Copy link
Copy Markdown
Contributor

"""

Walkthrough

The changes refactor how state is accessed from the useSearchStore hook in three components by switching from single destructuring assignments to individual selector calls for each state property. Additionally, the query's case sensitivity flag is now retrieved from state and passed to query submission handlers.

Changes

File(s) Change Summary
.../SearchPage/SearchControls/SearchButton/SubmitButton.tsx Refactored state extraction from useSearchStore to use individual selectors; used queryIsCaseSensitive in query submission.
.../SearchPage/SearchResults/SearchResultsTimeline/index.tsx Refactored state extraction from useSearchStore to use individual selectors; used queryIsCaseSensitive in timeline zoom query submission.
.../SearchPage/SearchControls/QueryInput/index.tsx Refactored state extraction from useSearchStore to use individual selectors for query string and case sensitivity flags; updated callbacks to access update functions dynamically.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant SubmitButton
    participant useSearchStore
    participant handleQuerySubmit

    User->>SubmitButton: Click "Submit"
    SubmitButton->>useSearchStore: Get searchUiState, timeRange, queryString, queryIsCaseSensitive
    SubmitButton->>handleQuerySubmit: Submit query (ignoreCase = !queryIsCaseSensitive)
Loading

Possibly related issues

Possibly related PRs

Suggested reviewers

  • junhaoliao
    """

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f48dfb4 and 33cd3f7.

📒 Files selected for processing (2)
  • components/webui/client/src/pages/SearchPage/SearchControls/QueryInput/index.tsx (3 hunks)
  • components/webui/client/src/pages/SearchPage/SearchResults/SearchResultsTimeline/index.tsx (3 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.{cpp,hpp,java,js,jsx,tpp,ts,tsx}`: - Prefer `false == ` rather than `!`.

**/*.{cpp,hpp,java,js,jsx,tpp,ts,tsx}: - Prefer false == <expression> rather than !<expression>.

⚙️ Source: CodeRabbit Configuration File

List of files the instruction was applied to:

  • components/webui/client/src/pages/SearchPage/SearchControls/QueryInput/index.tsx
  • components/webui/client/src/pages/SearchPage/SearchResults/SearchResultsTimeline/index.tsx
🧠 Learnings (3)
📓 Common learnings
Learnt from: LinZhihao-723
PR: y-scope/clp#873
File: components/core/src/clp/ffi/ir_stream/search/QueryHandlerImpl.hpp:320-324
Timestamp: 2025-05-05T01:12:18.561Z
Learning: In the CLP codebase, the `m_case_sensitive_search` flag is used only for actual string value comparisons during query evaluation, not for schema key name matching. Schema keys are always compared case-sensitively regardless of this flag's setting.
Learnt from: junhaoliao
PR: y-scope/clp#962
File: components/log-viewer-webui/client/src/pages/SearchPage/SearchQueryStatus/Results.tsx:22-26
Timestamp: 2025-06-09T17:15:30.309Z
Learning: When using Zustand stores in React components, always use specific selectors (e.g., `useStore(state => state.property)`) instead of destructuring the entire state object to prevent unnecessary re-renders. This is especially important as state stores grow in complexity.
Learnt from: junhaoliao
PR: y-scope/clp#962
File: components/log-viewer-webui/client/src/pages/SearchPage/SearchQueryStatus/Results.tsx:22-26
Timestamp: 2025-06-09T17:15:30.309Z
Learning: When using Zustand stores in React components, always use specific selectors (e.g., `useStore(state => state.property)`) instead of destructuring the entire state object to prevent unnecessary re-renders. This is especially important as state stores grow in complexity.
Learnt from: junhaoliao
PR: y-scope/clp#596
File: components/log-viewer-webui/client/src/api/query.js:16-23
Timestamp: 2024-11-21T15:51:33.203Z
Learning: In `components/log-viewer-webui/client/src/api/query.js`, the `ExtractJsonResp` type definition is accurate as-is and does not require modification. When suggesting changes to type definitions, ensure they align with the server-side definitions, referencing the source code if necessary.
components/webui/client/src/pages/SearchPage/SearchControls/QueryInput/index.tsx (4)
Learnt from: junhaoliao
PR: y-scope/clp#962
File: components/log-viewer-webui/client/src/pages/SearchPage/SearchQueryStatus/Results.tsx:22-26
Timestamp: 2025-06-09T17:15:30.309Z
Learning: When using Zustand stores in React components, always use specific selectors (e.g., `useStore(state => state.property)`) instead of destructuring the entire state object to prevent unnecessary re-renders. This is especially important as state stores grow in complexity.
Learnt from: junhaoliao
PR: y-scope/clp#962
File: components/log-viewer-webui/client/src/pages/SearchPage/SearchQueryStatus/Results.tsx:22-26
Timestamp: 2025-06-09T17:15:30.309Z
Learning: When using Zustand stores in React components, always use specific selectors (e.g., `useStore(state => state.property)`) instead of destructuring the entire state object to prevent unnecessary re-renders. This is especially important as state stores grow in complexity.
Learnt from: junhaoliao
PR: y-scope/clp#596
File: components/log-viewer-webui/client/src/api/query.js:16-23
Timestamp: 2024-11-21T15:51:33.203Z
Learning: In `components/log-viewer-webui/client/src/api/query.js`, the `ExtractJsonResp` type definition is accurate as-is and does not require modification. When suggesting changes to type definitions, ensure they align with the server-side definitions, referencing the source code if necessary.
Learnt from: junhaoliao
PR: y-scope/clp#937
File: components/log-viewer-webui/client/src/AntdApp.tsx:16-24
Timestamp: 2025-05-29T20:33:40.653Z
Learning: In components/log-viewer-webui React codebase: Return type annotations (like `: JSX.Element`) are unnecessary and not preferred for React components in JSX/TSX files.
components/webui/client/src/pages/SearchPage/SearchResults/SearchResultsTimeline/index.tsx (7)
Learnt from: junhaoliao
PR: y-scope/clp#962
File: components/log-viewer-webui/client/src/pages/SearchPage/SearchQueryStatus/Results.tsx:22-26
Timestamp: 2025-06-09T17:15:30.309Z
Learning: When using Zustand stores in React components, always use specific selectors (e.g., `useStore(state => state.property)`) instead of destructuring the entire state object to prevent unnecessary re-renders. This is especially important as state stores grow in complexity.
Learnt from: junhaoliao
PR: y-scope/clp#962
File: components/log-viewer-webui/client/src/pages/SearchPage/SearchQueryStatus/Results.tsx:22-26
Timestamp: 2025-06-09T17:15:30.309Z
Learning: When using Zustand stores in React components, always use specific selectors (e.g., `useStore(state => state.property)`) instead of destructuring the entire state object to prevent unnecessary re-renders. This is especially important as state stores grow in complexity.
Learnt from: junhaoliao
PR: y-scope/clp#937
File: components/log-viewer-webui/client/src/AntdApp.tsx:16-24
Timestamp: 2025-05-29T20:33:40.653Z
Learning: In components/log-viewer-webui React codebase: Return type annotations (like `: JSX.Element`) are unnecessary and not preferred for React components in JSX/TSX files.
Learnt from: junhaoliao
PR: y-scope/clp#596
File: components/log-viewer-webui/client/src/api/query.js:16-23
Timestamp: 2024-11-21T15:51:33.203Z
Learning: In `components/log-viewer-webui/client/src/api/query.js`, the `ExtractJsonResp` type definition is accurate as-is and does not require modification. When suggesting changes to type definitions, ensure they align with the server-side definitions, referencing the source code if necessary.
Learnt from: LinZhihao-723
PR: y-scope/clp#873
File: components/core/src/clp/ffi/ir_stream/search/QueryHandlerImpl.hpp:320-324
Timestamp: 2025-05-05T01:12:18.561Z
Learning: In the CLP codebase, the `m_case_sensitive_search` flag is used only for actual string value comparisons during query evaluation, not for schema key name matching. Schema keys are always compared case-sensitively regardless of this flag's setting.
Learnt from: davemarco
PR: y-scope/clp#797
File: components/log-viewer-webui/client/src/components/Layout/MainLayout.tsx:2-5
Timestamp: 2025-04-08T22:32:05.366Z
Learning: In this codebase using React Router v7.4.1, components should be imported directly from "react-router" (e.g., `import { Link, Outlet } from "react-router";`) rather than from "react-router-dom" as was common in previous versions of React Router.
Learnt from: davemarco
PR: y-scope/clp#797
File: components/log-viewer-webui/client/src/components/Layout/MainLayout.tsx:2-5
Timestamp: 2025-04-08T22:32:05.367Z
Learning: React Router v7.4.1 uses a different package structure than previous versions. Components can be imported directly from "react-router" (e.g., `import { Link, Outlet } from "react-router";`) rather than from "react-router-dom" as was common in previous versions. Alternatively, DOM-specific components can also be imported using deep imports like `import { Link } from "react-router/dom";`.
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: lint-check (ubuntu-latest)
  • GitHub Check: lint-check (macos-latest)
🔇 Additional comments (3)
components/webui/client/src/pages/SearchPage/SearchControls/QueryInput/index.tsx (1)

81-82: LGTM! Proper callback usage.

The component correctly uses the memoized callback handlers, which will improve performance by preventing unnecessary re-renders.

components/webui/client/src/pages/SearchPage/SearchResults/SearchResultsTimeline/index.tsx (2)

49-49: Case sensitivity logic correctly implemented.

The ignoreCase: false === queryIsCaseSensitive logic correctly handles the case sensitivity setting and follows the coding guidelines preference for explicit boolean comparisons.


60-73: LGTM! Efficient useEffect implementation.

The refactoring correctly uses dynamic state access for the update function, which prevents unnecessary effect re-runs and follows the established pattern throughout the component.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@davemarco davemarco requested a review from junhaoliao July 2, 2025 19:48

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🔭 Outside diff range comments (1)
components/webui/client/src/pages/SearchPage/SearchControls/SearchButton/SubmitButton.tsx (1)

43-45: Add missing dependency to useCallback.

The queryIsCaseSensitive state is used in the callback but missing from the dependency array.

Apply this diff to fix the dependencies:

     }, [queryString,
         updateTimelineConfig,
-        timeRange]);
+        timeRange,
+        queryIsCaseSensitive]);
📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3520895 and 705da65.

📒 Files selected for processing (2)
  • components/webui/client/src/pages/SearchPage/SearchControls/SearchButton/SubmitButton.tsx (2 hunks)
  • components/webui/client/src/pages/SearchPage/SearchResults/SearchResultsTimeline/index.tsx (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.{cpp,hpp,java,js,jsx,tpp,ts,tsx}`: - Prefer `false == ` rather than `!`.

**/*.{cpp,hpp,java,js,jsx,tpp,ts,tsx}: - Prefer false == <expression> rather than !<expression>.

⚙️ Source: CodeRabbit Configuration File

List of files the instruction was applied to:

  • components/webui/client/src/pages/SearchPage/SearchControls/SearchButton/SubmitButton.tsx
  • components/webui/client/src/pages/SearchPage/SearchResults/SearchResultsTimeline/index.tsx
🧠 Learnings (3)
📓 Common learnings
Learnt from: junhaoliao
PR: y-scope/clp#962
File: components/log-viewer-webui/client/src/pages/SearchPage/SearchQueryStatus/Results.tsx:22-26
Timestamp: 2025-06-09T17:15:30.309Z
Learning: When using Zustand stores in React components, always use specific selectors (e.g., `useStore(state => state.property)`) instead of destructuring the entire state object to prevent unnecessary re-renders. This is especially important as state stores grow in complexity.
Learnt from: junhaoliao
PR: y-scope/clp#962
File: components/log-viewer-webui/client/src/pages/SearchPage/SearchQueryStatus/Results.tsx:22-26
Timestamp: 2025-06-09T17:15:30.309Z
Learning: When using Zustand stores in React components, always use specific selectors (e.g., `useStore(state => state.property)`) instead of destructuring the entire state object to prevent unnecessary re-renders. This is especially important as state stores grow in complexity.
Learnt from: LinZhihao-723
PR: y-scope/clp#873
File: components/core/src/clp/ffi/ir_stream/search/QueryHandlerImpl.hpp:320-324
Timestamp: 2025-05-05T01:12:18.561Z
Learning: In the CLP codebase, the `m_case_sensitive_search` flag is used only for actual string value comparisons during query evaluation, not for schema key name matching. Schema keys are always compared case-sensitively regardless of this flag's setting.
Learnt from: junhaoliao
PR: y-scope/clp#596
File: components/log-viewer-webui/client/src/api/query.js:16-23
Timestamp: 2024-11-21T15:51:33.203Z
Learning: In `components/log-viewer-webui/client/src/api/query.js`, the `ExtractJsonResp` type definition is accurate as-is and does not require modification. When suggesting changes to type definitions, ensure they align with the server-side definitions, referencing the source code if necessary.
components/webui/client/src/pages/SearchPage/SearchControls/SearchButton/SubmitButton.tsx (3)
Learnt from: junhaoliao
PR: y-scope/clp#962
File: components/log-viewer-webui/client/src/pages/SearchPage/SearchQueryStatus/Results.tsx:22-26
Timestamp: 2025-06-09T17:15:30.309Z
Learning: When using Zustand stores in React components, always use specific selectors (e.g., `useStore(state => state.property)`) instead of destructuring the entire state object to prevent unnecessary re-renders. This is especially important as state stores grow in complexity.
Learnt from: junhaoliao
PR: y-scope/clp#962
File: components/log-viewer-webui/client/src/pages/SearchPage/SearchQueryStatus/Results.tsx:22-26
Timestamp: 2025-06-09T17:15:30.309Z
Learning: When using Zustand stores in React components, always use specific selectors (e.g., `useStore(state => state.property)`) instead of destructuring the entire state object to prevent unnecessary re-renders. This is especially important as state stores grow in complexity.
Learnt from: junhaoliao
PR: y-scope/clp#596
File: components/log-viewer-webui/client/src/api/query.js:16-23
Timestamp: 2024-11-21T15:51:33.203Z
Learning: In `components/log-viewer-webui/client/src/api/query.js`, the `ExtractJsonResp` type definition is accurate as-is and does not require modification. When suggesting changes to type definitions, ensure they align with the server-side definitions, referencing the source code if necessary.
components/webui/client/src/pages/SearchPage/SearchResults/SearchResultsTimeline/index.tsx (4)
Learnt from: junhaoliao
PR: y-scope/clp#962
File: components/log-viewer-webui/client/src/pages/SearchPage/SearchQueryStatus/Results.tsx:22-26
Timestamp: 2025-06-09T17:15:30.309Z
Learning: When using Zustand stores in React components, always use specific selectors (e.g., `useStore(state => state.property)`) instead of destructuring the entire state object to prevent unnecessary re-renders. This is especially important as state stores grow in complexity.
Learnt from: junhaoliao
PR: y-scope/clp#962
File: components/log-viewer-webui/client/src/pages/SearchPage/SearchQueryStatus/Results.tsx:22-26
Timestamp: 2025-06-09T17:15:30.309Z
Learning: When using Zustand stores in React components, always use specific selectors (e.g., `useStore(state => state.property)`) instead of destructuring the entire state object to prevent unnecessary re-renders. This is especially important as state stores grow in complexity.
Learnt from: junhaoliao
PR: y-scope/clp#596
File: components/log-viewer-webui/client/src/api/query.js:16-23
Timestamp: 2024-11-21T15:51:33.203Z
Learning: In `components/log-viewer-webui/client/src/api/query.js`, the `ExtractJsonResp` type definition is accurate as-is and does not require modification. When suggesting changes to type definitions, ensure they align with the server-side definitions, referencing the source code if necessary.
Learnt from: junhaoliao
PR: y-scope/clp#937
File: components/log-viewer-webui/client/src/AntdApp.tsx:16-24
Timestamp: 2025-05-29T20:33:40.653Z
Learning: In components/log-viewer-webui React codebase: Return type annotations (like `: JSX.Element`) are unnecessary and not preferred for React components in JSX/TSX files.
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: lint-check (ubuntu-latest)
  • GitHub Check: lint-check (macos-latest)
  • GitHub Check: build (macos-latest)
🔇 Additional comments (2)
components/webui/client/src/pages/SearchPage/SearchControls/SearchButton/SubmitButton.tsx (1)

22-26: Excellent refactoring to individual selectors.

This change aligns perfectly with the retrieved learning about using specific selectors instead of destructuring the entire state object to prevent unnecessary re-renders.

components/webui/client/src/pages/SearchPage/SearchResults/SearchResultsTimeline/index.tsx (1)

22-31: Excellent refactoring to individual selectors.

This change follows the same beneficial pattern as the SubmitButton component, using specific selectors to prevent unnecessary re-renders.

@junhaoliao junhaoliao left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for the PR title, how about:

fix(webui): Respect case sensitivity setting in search queries (fixes #1060); refactor Zustand usages.

Comment on lines +24 to +28
const queryString = useSearchStore((state) => state.queryString);
const queryIsCaseSensitive = useSearchStore((state) => state.queryIsCaseSensitive);
const updateQueryString = useSearchStore((state) => state.updateQueryString);
const updateQueryIsCaseSensitive = useSearchStore((state) => state.updateQueryIsCaseSensitive);
const searchUiState = useSearchStore((state) => state.searchUiState);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. let's try to alphabetize the state retreivals
  2. for actions whose definitions usually won't change, let's retrieve them non-reactively
Suggested change
const queryString = useSearchStore((state) => state.queryString);
const queryIsCaseSensitive = useSearchStore((state) => state.queryIsCaseSensitive);
const updateQueryString = useSearchStore((state) => state.updateQueryString);
const updateQueryIsCaseSensitive = useSearchStore((state) => state.updateQueryIsCaseSensitive);
const searchUiState = useSearchStore((state) => state.searchUiState);
const queryIsCaseSensitive = useSearchStore((state) => state.queryIsCaseSensitive);
const queryString = useSearchStore((state) => state.queryString);
const searchUiState = useSearchStore((state) => state.searchUiState);

...

    const handleCaseSensitiveChange = useCallback((newValue: boolean) => {
        const {updateQueryIsCaseSensitive} = useSearchStore.getState();
        updateQueryIsCaseSensitive(newValue);
    }, []);

    const handleChange = useCallback((ev: ChangeEvent<HTMLInputElement>) => {
        const {updateQueryString} = useSearchStore.getState();
        updateQueryString(ev.target.value);
    }, []);
        <QueryBox
            isCaseSensitive={queryIsCaseSensitive}
            placeholder={"Enter your query"}
            progress={pseudoProgress}
            size={"large"}
            value={queryString}
            disabled={
                searchUiState === SEARCH_UI_STATE.QUERY_ID_PENDING ||
                searchUiState === SEARCH_UI_STATE.QUERYING
            }
            onCaseSensitiveChange={handleCaseSensitiveChange}
            onChange={handleChange}/>

Comment on lines +22 to +26
const searchUiState = useSearchStore((state) => state.searchUiState);
const timeRange = useSearchStore((state) => state.timeRange);
const queryString = useSearchStore((state) => state.queryString);
const updateTimelineConfig = useSearchStore((state) => state.updateTimelineConfig);
const queryIsCaseSensitive = useSearchStore((state) => state.queryIsCaseSensitive);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. ditto: order
  2. ditto: action retrieval
Suggested change
const searchUiState = useSearchStore((state) => state.searchUiState);
const timeRange = useSearchStore((state) => state.timeRange);
const queryString = useSearchStore((state) => state.queryString);
const updateTimelineConfig = useSearchStore((state) => state.updateTimelineConfig);
const queryIsCaseSensitive = useSearchStore((state) => state.queryIsCaseSensitive);
const queryIsCaseSensitive = useSearchStore((state) => state.queryIsCaseSensitive);
const queryString = useSearchStore((state) => state.queryString);
const searchUiState = useSearchStore((state) => state.searchUiState);
const timelineConfig = useSearchStore((state) => state.timelineConfig);

...

    const handleTimelineZoom = useCallback((newTimeRange: [Dayjs, Dayjs]) => {
        const newTimelineConfig: TimelineConfig = computeTimelineConfig(newTimeRange);

        // Update range picker selection to match zoomed range.
        const {
            updateTimeRange, updateTimeRangeOption, updateTimelineConfig,
        } = useSearchStore.getState();

        updateTimeRange(newTimeRange);
        updateTimeRangeOption(TIME_RANGE_OPTION.CUSTOM);
        updateTimelineConfig(newTimelineConfig);

        const isQueryStringEmpty = queryString === SEARCH_STATE_DEFAULT.queryString;
        if (isQueryStringEmpty) {
            return;
        }

        handleQuerySubmit({
            ignoreCase: false === queryIsCaseSensitive,
            queryString: queryString,
            timeRangeBucketSizeMillis: newTimelineConfig.bucketDuration.asMilliseconds(),
            timestampBegin: newTimeRange[0].valueOf(),
            timestampEnd: newTimeRange[1].valueOf(),
        });
    }, [
        queryIsCaseSensitive,
        queryString,
    ]);

(also move handleTimelineZoom to show up before the useEffect() block)

Comment on lines +22 to +31
const queryString = useSearchStore((state) => state.queryString);
const updateTimeRange = useSearchStore((state) => state.updateTimeRange);
const updateTimeRangeOption = useSearchStore((state) => state.updateTimeRangeOption);
const timelineConfig = useSearchStore((state) => state.timelineConfig);
const searchUiState = useSearchStore((state) => state.searchUiState);
const updateTimelineConfig = useSearchStore((state) => state.updateTimelineConfig);
const updateNumSearchResultsTimeline = useSearchStore(
(state) => state.updateNumSearchResultsTimeline
);
const queryIsCaseSensitive = useSearchStore((state) => state.queryIsCaseSensitive);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const queryString = useSearchStore((state) => state.queryString);
const updateTimeRange = useSearchStore((state) => state.updateTimeRange);
const updateTimeRangeOption = useSearchStore((state) => state.updateTimeRangeOption);
const timelineConfig = useSearchStore((state) => state.timelineConfig);
const searchUiState = useSearchStore((state) => state.searchUiState);
const updateTimelineConfig = useSearchStore((state) => state.updateTimelineConfig);
const updateNumSearchResultsTimeline = useSearchStore(
(state) => state.updateNumSearchResultsTimeline
);
const queryIsCaseSensitive = useSearchStore((state) => state.queryIsCaseSensitive);
const queryString = useSearchStore((state) => state.queryString);
const queryIsCaseSensitive = useSearchStore((state) => state.queryIsCaseSensitive);
const searchUiState = useSearchStore((state) => state.searchUiState);
const timeRange = useSearchStore((state) => state.timeRange);

...

    const handleSubmitButtonClick = useCallback(() => {
        // Update timeline to match range picker selection.
        const newTimelineConfig = computeTimelineConfig(timeRange);
        const {updateTimelineConfig} = useSearchStore.getState();
        updateTimelineConfig(newTimelineConfig);

        handleQuerySubmit({
            ignoreCase: false === queryIsCaseSensitive,
            queryString: queryString,
            timeRangeBucketSizeMillis: newTimelineConfig.bucketDuration.asMilliseconds(),
            timestampBegin: timeRange[0].valueOf(),
            timestampEnd: timeRange[1].valueOf(),
        });
    }, [
        queryString,
        queryIsCaseSensitive,
        timeRange,
    ]);

@davemarco davemarco changed the title fix(new-webui): Include case-sensitivity option when submitting query (resolves #1060). fix(webui): Respect case sensitivity setting in search queries (fixes #1060); refactor Zustand usages. Jul 3, 2025
@davemarco davemarco merged commit c74bbd8 into y-scope:main Jul 3, 2025
8 checks passed
quinntaylormitchell pushed a commit to quinntaylormitchell/clp that referenced this pull request Jul 4, 2025
…-scope#1060); refactor Zustand usages. (y-scope#1063)

Co-authored-by: Marco <david.marcovitch@yscope.com>
junhaoliao pushed a commit to junhaoliao/clp that referenced this pull request May 17, 2026
…-scope#1060); refactor Zustand usages. (y-scope#1063)

Co-authored-by: Marco <david.marcovitch@yscope.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants