fix: initial steward values [ENG-3411]#7914
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
4108836 to
36e1edf
Compare
36e1edf to
388f123
Compare
388f123 to
bed46ad
Compare
There was a problem hiding this comment.
Code Review: PR #7914 — fix: initial steward values [ENG-3411]
Scope: Frontend only (TypeScript/React). No backend changes.
This PR fixes an out-of-sync steward filter on the action center root page by removing the defaultStewardFilter default from SearchFormQueryState and instead applying it via a useEffect after the user's monitor assignments are fetched. It also exposes setSearchForm from useSearchForm and changes showSearch + optionFilterProp to an object syntax.
Critical (must fix)
MonitorListSearchForm.tsx — showSearch={{ optionFilterProp: "label" }} is not a valid Ant Design API. Select's showSearch prop accepts a boolean, not an object. The object is truthy so search is enabled, but optionFilterProp inside it is silently ignored, causing the dropdown to filter by value instead of label. Steward name search will break. See inline comment.
Suggestions
MonitorList.tsx — formProps.setSearchForm inside the useEffect and its dependency array is slightly indirect. Destructuring setSearchForm out of formProps at the call site would be cleaner and make the dependency array easier to read. See inline comment.
MonitorList.tsx (timing) — defaultStewardFilter is undefined until useGetUserMonitorsQuery resolves, so the component will briefly render and fire an API call without the steward filter before the effect kicks in. This is the same race that existed before (the old defaultStewardFilter argument to SearchFormQueryState had the same issue), so it's not a regression. If the flash is unacceptable in the future, the fix would be to defer rendering the monitor list until the user-monitors query has resolved.
MonitorList.tsx (initialValues) — steward_key: defaultStewardFilter ?? null in initialValues is always null on the first render (since the query hasn't resolved yet) and is then overwritten by the effect. The line is doing nothing useful for steward_key and its intent is slightly misleading — a comment explaining why would help future readers.
Nit
changelog/7914-fix-steward-filter.yaml — type field is blank; should be Fixed. See inline comment.
One blocking issue (showSearch object syntax), otherwise the approach is sound.
🔬 Codegraph: connected (46711 nodes)
💡 Write /code-review in a comment to re-run this review.
chore: formatting refactor: different default method chore: update changelog chore: update effect deps chore: fixing changelog refactor: destructured item
bed46ad to
3e66c20
Compare
gilluminate
left a comment
There was a problem hiding this comment.
testing worked as expected!
Ticket ENG-3411
Description Of Changes
Fixes an issue where the state of the stewards filter on the root action center would be out of sync with the url and requests when logged in as a steward assigned to a monitor.
Code Changes
Steps to Confirm
assigned to mePre-Merge Checklist
CHANGELOG.mdupdatedmaindowngrade()migration is correct and works