Skip to content

fix(DesignerV2): Persist search term in Redux to prevent reset#9188

Merged
rllyy97 merged 2 commits into
mainfrom
riley/fix/panel-resize-search-reset
May 19, 2026
Merged

fix(DesignerV2): Persist search term in Redux to prevent reset#9188
rllyy97 merged 2 commits into
mainfrom
riley/fix/panel-resize-search-reset

Conversation

@rllyy97
Copy link
Copy Markdown
Contributor

@rllyy97 rllyy97 commented May 18, 2026

Commit Type

  • feature - New functionality
  • fix - Bug fix
  • refactor - Code restructuring without behavior change
  • perf - Performance improvement
  • docs - Documentation update
  • test - Test-related changes
  • chore - Maintenance/tooling

Risk Level

  • Low - Minor changes, limited scope
  • Medium - Moderate changes, some user impact
  • High - Major changes, significant user/system impact

What & Why

Fixes #9173 - The search text in the "Add a trigger/action" panel was being cleared whenever the panel was resized (enlarged/collapsed).

Root cause: Two issues combined:

  1. width was included in the commonPanelProps useMemo dependency array, causing child components to re-render on every resize pixel change.
  2. The search term was stored in local useState, which resets when the component re-mounts due to the parent re-render.

Fix: Moved the search term to Redux state so it persists across re-renders, and removed the unused width prop from commonPanelProps (it wasn't part of the CommonPanelProps type interface).

Impact of Change

  • Users: Search text now persists when resizing the discovery panel - no longer need to re-type searches after enlarging
  • Developers: New setDiscoverySearchTerm action and useDiscoveryPanelSearchTerm selector available in the panel state
  • System: Slight reduction in unnecessary re-renders when panel is resized

Test Plan

  • Unit tests added/updated
  • E2E tests added/updated
  • Manual testing completed
  • Tested in: Standalone designer, verified search term persists across panel resize

Contributors

Screenshots/Videos

Copilot AI review requested due to automatic review settings May 18, 2026 19:55
@rllyy97 rllyy97 added the risk:low Low risk change with minimal impact label May 18, 2026
@rllyy97 rllyy97 enabled auto-merge (squash) May 18, 2026 19:56
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 18, 2026

🤖 AI PR Validation Report

PR Review Results

Thank you for your submission! Here's detailed feedback on your PR title and body compliance:

PR Title

  • Current: fix(DesignerV2): Persist search term in Redux to prevent reset
  • Issue: None — title is clear, concise, and follows conventional commit style. It describes the area (DesignerV2) and the change intent (persist search term).
  • Recommendation: None required. (Optional: include the issue number in the title if your team prefers that convention, e.g. fix(DesignerV2): Persist search term in Redux to prevent reset (#9173))

Commit Type

  • Properly selected (fix).
  • Only one commit type selected which is correct.

Risk Level

  • The PR body marks the change as Low and the repo labels include risk:low. This matches the scope of the changes (state moved to Redux, minor selector/slice additions, removal of an unused dependency, and unit tests added).

What & Why

  • Current: Fixes search text doesn't stay filtered when enlarging #9173 and explains the root cause (width in useMemo dependency + local state cleared on remount) and the fix (move search term to Redux and remove width from dependencies).
  • Issue: None — explanation is brief and accurate.
  • Recommendation: None.

Impact of Change

  • Impact section is present and accurate:
    • Users: Search text persists on resize.
    • Developers: New action and selector introduced.
    • System: Reduced re-renders.
  • Recommendation: Consider a brief note about whether this change affects any persisted UI state (e.g., localStorage/rehydration) if applicable — not necessary if panel state is transient.

Test Plan

  • Assessment: Unit tests were claimed and are actually present in the diff (new and updated tests added). Manual testing is claimed and acceptable for this UI behavior. E2E tests are not present and that's reasonable for this scope, but consider adding one if you have an established E2E pattern for panel interactions.
  • Recommendation: If your CI requires coverage gates for Redux changes, ensure the new tests run in CI. If this behavior is critical for user flows, consider adding an E2E test in future.

⚠️ Contributors

  • Assessment: Empty in the PR body.
  • Recommendation: It's optional but recommended to add a short contributors section to credit reviewers, PMs, or designers who gave input (helpful for release notes and credits). This is not required to pass.

⚠️ Screenshots/Videos

  • Assessment: None provided. For this change (non-visual behavior, state persistence) screenshots are not necessary.
  • Recommendation: No action required unless reviewers request a short video showing the persistence across resize.

Summary Table

Section Status Recommendation
Title None
Commit Type None
Risk Level None
What & Why None
Impact of Change Optional note about persisted UI state
Test Plan Ensure tests run in CI; consider E2E if critical
Contributors ⚠️ Add contributors (optional)
Screenshots/Videos ⚠️ Not required for this change

Final message: This PR passes the PR body/title checks. The advised risk level from the code diff is Low, which matches the submitter-provided risk. The PR contains the relevant unit tests and the change is well-described. Please consider adding an optional Contributors line and (optionally) an E2E test if your team prefers coverage for UI flows. Thank you for the clear PR!


Last updated: Mon, 18 May 2026 20:29:38 GMT

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes #9173 where the trigger/action search text was reset when resizing the discovery panel. The root cause was twofold: width was a dependency of the commonPanelProps memo (causing child remounts on every resize), and the search term was stored in component-local state that didn't survive those remounts. The fix promotes the search term to Redux and removes width from the memo dependencies (the field wasn't part of CommonPanelProps anyway).

Changes:

  • Add searchTerm to DiscoveryPanelContentState with a setDiscoverySearchTerm reducer and a useDiscoveryPanelSearchTerm selector.
  • Switch RecommendationPanelContext from local useState to the new Redux-backed search term.
  • Remove the unused width field from commonPanelProps in panelRoot.tsx to prevent re-render churn on resize.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
libs/designer-v2/src/lib/core/state/panel/panelTypes.ts Adds searchTerm: string to discovery panel content state.
libs/designer-v2/src/lib/core/state/panel/panelSlice.ts Adds initial value, reducer, and export for setDiscoverySearchTerm.
libs/designer-v2/src/lib/core/state/panel/panelSelectors.ts Adds useDiscoveryPanelSearchTerm selector hook.
libs/designer-v2/src/lib/ui/panel/recommendation/recommendationPanelContext.tsx Replaces local search-term state with Redux selector/dispatcher.
libs/designer-v2/src/lib/ui/panel/recommendation/test/recommendationPanelContext.spec.tsx Updates mocks and tests to use the new selector instead of typing into the input.
libs/designer-v2/src/lib/ui/panel/panelRoot.tsx Removes width from commonPanelProps and its memo deps to avoid resize-driven re-renders.

Comment thread libs/designer-v2/src/lib/core/state/panel/panelSlice.ts
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 18, 2026

📊 Coverage Check

The following changed files need attention:

⚠️ libs/designer-v2/src/lib/core/state/panel/panelSelectors.ts - 64% covered (needs improvement)
⚠️ libs/designer-v2/src/lib/core/state/panel/panelSlice.ts - 11% covered (needs improvement)

Please add tests for the uncovered files before merging.

@rllyy97 rllyy97 merged commit 98eed53 into main May 19, 2026
16 of 17 checks passed
@rllyy97 rllyy97 deleted the riley/fix/panel-resize-search-reset branch May 19, 2026 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-validated risk:low Low risk change with minimal impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

search text doesn't stay filtered when enlarging

3 participants