fix(DesignerV2): Persist search term in Redux to prevent reset#9188
Conversation
🤖 AI PR Validation ReportPR Review ResultsThank you for your submission! Here's detailed feedback on your PR title and body compliance:✅ PR Title
✅ Commit Type
✅ Risk Level
✅ What & Why
✅ Impact of Change
✅ Test Plan
|
| 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
There was a problem hiding this comment.
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
searchTermtoDiscoveryPanelContentStatewith asetDiscoverySearchTermreducer and auseDiscoveryPanelSearchTermselector. - Switch
RecommendationPanelContextfrom localuseStateto the new Redux-backed search term. - Remove the unused
widthfield fromcommonPanelPropsinpanelRoot.tsxto 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. |
📊 Coverage CheckThe following changed files need attention:
Please add tests for the uncovered files before merging. |
Commit Type
Risk Level
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:
widthwas included in thecommonPanelPropsuseMemo dependency array, causing child components to re-render on every resize pixel change.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
widthprop fromcommonPanelProps(it wasn't part of theCommonPanelPropstype interface).Impact of Change
setDiscoverySearchTermaction anduseDiscoveryPanelSearchTermselector available in the panel stateTest Plan
Contributors
Screenshots/Videos