refactor: monitor fields filters [ENG-2450]#7411
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
ce0839e to
13b1aee
Compare
| export type MonitorFieldSearchForm = | ||
| v.InferOutput<typeof MonitorFieldSearchFormQuerySchema> extends Values< | ||
| typeof MonitorFieldSearchFormQueryState | ||
| > | ||
| ? v.InferOutput<typeof MonitorFieldSearchFormQuerySchema> | ||
| : never; |
There was a problem hiding this comment.
Temporary method of handling schema type checking between nuqs and valibot.
Future type handling should also bind valibot to ant forms for better interop.
There was a problem hiding this comment.
consider adding this explanation as a comment in the code
| form.submit(); | ||
|
|
||
| const onFinish: FormProps<FormType>["onFinish"] = (values) => { | ||
| const { success, output } = safeParse(schema, values); |
There was a problem hiding this comment.
Better than what we had previously.
Ideally the parse success/fail handling should match ant.
This can be done by either injecting/overriding ant's validator (preferred) or by syncing ant's settings with valibot.
13b1aee to
156ede3
Compare
156ede3 to
ac052af
Compare
Greptile SummaryThis PR refactors the monitor fields screen filters from a tree-based
Confidence Score: 3/5
Important Files Changed
Last reviewed commit: ac052af |
...ui/src/features/data-discovery-and-detection/action-center/forms/MonitorFieldsSearchForm.tsx
Outdated
Show resolved
Hide resolved
...ui/src/features/data-discovery-and-detection/action-center/forms/MonitorFieldsSearchForm.tsx
Outdated
Show resolved
Hide resolved
| }; | ||
|
|
||
| // Unfortunate need for effect due to current routing strategy | ||
| // Unfortunate need for effect due to current routin strategy |
There was a problem hiding this comment.
Typo: "routin" → "routing"
| // Unfortunate need for effect due to current routin strategy | |
| // Unfortunate need for effect due to current routing strategy |
| const baseMonitorFilters = { | ||
| path: { | ||
| monitor_config_id: monitorId, | ||
| }, | ||
| query: { | ||
| staged_resource_urn: selectedNodeKeys.map((key) => key.toString()), | ||
| search: search.searchProps.value, | ||
| diff_status: resourceStatus | ||
| ? resourceStatus.flatMap(intoDiffStatus) | ||
| : undefined, | ||
| confidence_bucket: confidenceBucket || undefined, | ||
| data_category: dataCategory || undefined, | ||
| search: form.getFieldValue("search"), | ||
| diff_status: | ||
| form.getFieldValue("resource_status")?.flatMap(intoDiffStatus) || | ||
| undefined, | ||
| confidence_bucket: form.getFieldValue("confidence_bucket") || undefined, | ||
| data_category: form.getFieldValue("data_category") || undefined, | ||
| }, | ||
| }; |
There was a problem hiding this comment.
form.getFieldValue is not reactive
baseMonitorFilters reads filter values via form.getFieldValue(), which is an imperative read of Ant Design's form store. Unlike the previous implementation which used reactive state from useMonitorFieldsFilters, these calls only return the value at render time and don't subscribe to changes. The object will only update when something else triggers a re-render (e.g., nuqs state update propagating back).
Since useSearchForm already returns requestData (which is derived from the reactive nuqs searchForm state), consider using requestData here instead of form.getFieldValue() to ensure filter values are always in sync with the URL state. Currently requestData is destructured on line 84 but never used.
gilluminate
left a comment
There was a problem hiding this comment.
Greptile's feedback seems legit, and I agree with those. Three nitpicks of my own to add to that.
| export type MonitorFieldSearchForm = | ||
| v.InferOutput<typeof MonitorFieldSearchFormQuerySchema> extends Values< | ||
| typeof MonitorFieldSearchFormQueryState | ||
| > | ||
| ? v.InferOutput<typeof MonitorFieldSearchFormQuerySchema> | ||
| : never; |
There was a problem hiding this comment.
consider adding this explanation as a comment in the code
clients/admin-ui/src/features/data-discovery-and-detection/action-center/fields/page.tsx
Show resolved
Hide resolved
...min-ui/src/features/data-discovery-and-detection/action-center/fields/MonitorFields.const.ts
Show resolved
Hide resolved
6539b40 to
7226e60
Compare
wip: ehhhh wip: finally something somewhat better chore: clean ups fix: minor styles fix: last of the issues chore: update changelog fix: autofocus fix: filter data categories lint and format fix: datastore filter refresh
bab8672 to
cdec2b5
Compare
| path: { monitor_config_id: monitorId }, | ||
| query: { | ||
| confidence_bucket: query.confidence_bucket ?? undefined, | ||
| data_category: query.confidence_bucket ?? undefined, |
There was a problem hiding this comment.
copy/paste error?
| data_category: query.confidence_bucket ?? undefined, | |
| data_category: query.data_category ?? undefined, |
Ticket ENG-2450
Description Of Changes
Refactoring the search filters on the monitor fields screen to be dropdowns instead of using the tree filter component
Code Changes
useSearchFormhook to have better typesSteps to Confirm
Action CenterscreenDatastoremonitor typePre-Merge Checklist
CHANGELOG.mdupdatedmaindowngrade()migration is correct and works