Skip to content

feat(query-builder): migrate QueryBuilderWidgetV1 from antd to core-components - #29849

Merged
anuj-kumary merged 138 commits into
mainfrom
migrate-querybuilder-antd-to-core
Aug 27, 2026
Merged

anuj-kumary merged 138 commits into
mainfrom
migrate-querybuilder-antd-to-core

Conversation

@chirag-madlani

@chirag-madlani chirag-madlani commented Jul 8, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Replaces all @react-awesome-query-builder/antd imports with @react-awesome-query-builder/ui (API-identical, same version) across 14 production files and 8 test files
  • Builds a custom OMConfig from BasicConfig with new widget factories backed by openmetadata-ui-core-components, eliminating Ant Design widget rendering inside query builder rules
  • Migrates QueryBuilderWidgetV1 outer shell (Card, Alert, Skeleton, Divider, Typography) from antd to core-components
  • Migrates button renderers in AdvancedSearchUtils and QueryBuilderUtils from antd Button + @ant-design/icons to core Button + @untitledui/icons
  • All query logic, config structure, elasticsearch format utilities, operator definitions, and async autocomplete behavior are preserved unchanged
Screen.Recording.2026-08-24.at.9.11.07.PM.mov
Screen.Recording.2026-08-24.at.9.29.51.PM.mov
Screen.Recording.2026-08-24.at.9.31.14.PM.mov

New widgets (src/utils/queryBuilderWidgets/)

Widget Core component
OMTextWidget Input
OMNumberWidget Input (numeric)
OMSelectWidget Select with async adapter
OMMultiSelectWidget MultiSelect + useListData from react-stately
OMBooleanWidget Toggle
OMDateWidget Native <input type="date/datetime-local/time"> (core DateInput is not publicly exported and requires @internationalized/date objects incompatible with RAQB string values)
OMFieldSelect Select (field/operator picker)
OMConjs ButtonGroup (AND/OR conjunction)

All assembled into src/utils/QueryBuilderOMConfig.tsx which exports OMConfig.

Test plan

  • All 27 QueryBuilderWidgetV1 tests pass
  • All 12 widget unit tests pass (src/utils/queryBuilderWidgets/)
  • Advanced Search modal opens and fields render correctly (no antd widget flash)
  • Adding/removing rules and groups works with the new button renderers
  • Async field autocomplete (owner, tags, tier) resolves correctly
  • JSON logic query builder (data contract) shows OM-styled widgets
  • TypeScript compiles with no new errors

🤖 Generated with Claude Code

Greptile Summary

This PR migrates the query builder UI away from Ant Design. The main changes are:

  • Query-builder imports moved to @react-awesome-query-builder/ui.
  • New OpenMetadata-styled field, value, conjunction, and button renderers.
  • Core component updates for select, multiselect, combobox, and popover behavior.
  • Playwright and unit tests updated for the new component structure.

Confidence Score: 4/5

This is close, but these issues should be fixed before merging.

  • Enum custom-property multiselects still cannot request later async pages.
  • Number inputs can still commit Infinity into query state.
  • The operator renderer now matches the query-builder callback shape.

Files Needing Attention: OMMultiSelectWidget.tsx and OMNumberWidget.tsx

Important Files Changed

Filename Overview
openmetadata-ui/src/main/resources/ui/src/utils/queryBuilderWidgets/OMMultiSelectWidget.tsx Async results are accumulated and saved chips are rendered, but later enum pages are still not requested.
openmetadata-ui/src/main/resources/ui/src/utils/queryBuilderWidgets/OMNumberWidget.tsx The local editing state avoids transient NaN, but non-finite numbers can still enter query state.
openmetadata-ui/src/main/resources/ui/src/utils/QueryBuilderOMConfig.tsx The custom config wires the OpenMetadata renderers into the query-builder configuration.

Reviews (59): Last reviewed commit: "Merge branch 'main' into migrate-querybu..." | Re-trigger Greptile

Greptile also left 2 inline comments on this PR.

Context used (3)

  • Context used - openmetadata-ui-core-components/CLAUDE.md (source)
  • Context used - CLAUDE.md (source)
  • Context used - AGENTS.md (source)

chirag-madlani and others added 13 commits July 8, 2026 14:55
…nput

Replace @react-awesome-query-builder/antd widgets with core-components. Two new widgets using Input component:
- OMTextWidget: string input values
- OMNumberWidget: numeric input with type="number"

All tests passing, TypeScript strict compilation verified.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…support

Implements Task 3 of the query builder migration from Ant Design to
openmetadata-ui-core-components. Provides async-capable single-select
widget wrapping core Select component. Includes handling for both static
list values and async fetch callbacks, with proper TypeScript typing.

- Converts listValues (array or object format) to SelectItemType[]
- Supports async data loading via asyncFetch callback
- Properly disables when readonly
- Fully tested with 2 core test cases (render + disabled state)

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…m core-component widgets

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…ate button renderers to core-components

- AdvancedSearchClassBase: replace BasicConfig value with OMConfig from QueryBuilderOMConfig;
  BasicConfig is now type-only
- AdvancedSearchUtils: renderAdvanceSearchButtons uses Button (core), X and Trash01 icons
  from @untitledui/icons; removes @ant-design/icons and antd Button imports
- QueryBuilderUtils: renderQueryBuilderFilterButtons and renderJSONLogicQueryBuilderButtons
  use Button (core) and X/Plus from @untitledui/icons; removes antd and @ant-design/icons imports

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…and button renderers

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…-components, clean up LESS

- Replace antd Card/Row/Col/Skeleton/Alert/Button/Divider/Typography with
  @openmetadata/ui-core-components equivalents
- Replace @ant-design/icons InfoCircleOutlined with @untitledui/icons InfoCircle
- Remove all .ant-* selectors from LESS; replace Less variable refs with
  CSS custom properties (--color-*)
- Update skeleton test selector from .ant-skeleton.ant-skeleton-active to
  [aria-hidden="true"] (core Skeleton uses aria-hidden)
- Update padding class test from .ant-col/.p-t-sm to .tw\\:pt-2

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Updated 7 test files to import from @react-awesome-query-builder/ui instead
of @react-awesome-query-builder/antd, and replaced AntdConfig with BasicConfig.
Applied UI checkstyle (organize-imports, lint:fix, prettier) on all modified
test files.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…invalid type cast, wire JSONLogicSearchClassBase to OMConfig

- OMDateWidget: replace getInputType(operator) with fieldType prop — operator values like "equal"/"less" never contain "time"/"datetime"; fieldType is the correct discriminant
- OMDateWidget: fix tw:bg-disabled_subtle → tw:bg-disabled-subtle (underscore → dash matches CSS token)
- OMNumberWidget: remove impossible `as number & null` intersection cast; Number(v) is already number
- JSONLogicSearchClassBase: import OMConfig and set baseConfig = OMConfig so JSON-logic query builder uses OM-styled widgets consistently with AdvancedSearchClassBase

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@chirag-madlani
chirag-madlani requested a review from a team as a code owner July 8, 2026 15:13
Copilot AI lite review requested due to automatic review settings July 8, 2026 15:13

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically.

Maintainers can bypass this check by adding the skip-pr-checks label.

@github-actions github-actions Bot added safe to test Add this label to run secure Github workflows on PRs UI UI specific issues labels Jul 8, 2026
Comment on lines +78 to +91
async (search: string) => {
if (!asyncFetch) {
return;
}
const result = await asyncFetch(search);
setAllItems(
(result.values as ListItem[]).map((item) => ({
id: String(item.value),
label: String(item.title ?? item.value),
}))
);
},
[asyncFetch]
);

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.

P1 Async Pagination Is Dropped

The multi-select adapter always calls asyncFetch(search) and discards the returned hasMore state. Fetchers such as enum/custom-property autocomplete accept an offset and can return more pages, so values after the first page can never be loaded or selected in the query builder.

Comment on lines +58 to +75
useEffect(() => {
const currentIds = new Set(selectedItems.items.map((i) => i.id));
const targetIds = new Set(valueArray);

for (const id of targetIds) {
if (!currentIds.has(id)) {
const item = allItems.find((i) => i.id === id);
if (item) {
selectedItems.append(item);
}
}
}
for (const item of selectedItems.items) {
if (!targetIds.has(item.id)) {
selectedItems.remove(item.id);
}
}
}, [valueArray.join(',')]);

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.

P1 Saved Async Values Disappear

When a saved async multiselect filter is rendered, allItems is initially empty, so the sync effect cannot append chips for the current valueArray. After the async options arrive, the effect does not rerun for the same value, leaving persisted owner, tag, tier, or custom-property filters visually unselected even though the tree still contains their values.

Comment on lines +29 to +30
value={value !== null && value !== undefined ? String(value) : ''}
onChange={(v: string) => setValue(v === '' ? null : Number(v))}

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.

P2 Intermediate Numbers Store NaN

Number(v) is stored for every non-empty number-input string. Browser number inputs can emit intermediate values like 1e, -, or ., which convert to NaN; that value then enters the query tree and can produce an invalid or non-matching generated filter.

Suggested change
value={value !== null && value !== undefined ? String(value) : ''}
onChange={(v: string) => setValue(v === '' ? null : Number(v))}
value={value !== null && value !== undefined ? String(value) : ''}
onChange={(v: string) => {
if (v === '') {
setValue(null);
return;
}
const nextValue = Number(v);
if (Number.isFinite(nextValue)) {
setValue(nextValue);
}
}}

@github-actions

github-actions Bot commented Jul 8, 2026 •

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 67%
67.15% (80342/119642) 51.63% (48891/94686) 52.66% (14759/28026)

@github-actions

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — manual (2026-08-26T11:51:29Z)

The entry left the queue before it was built, so no checks ran against it.

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review is ineligible. To be eligible to request a review, you need a paid Copilot license, or your organization must enable Copilot code review.

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review is ineligible. To be eligible to request a review, you need a paid Copilot license, or your organization must enable Copilot code review.

Comment on lines +53 to +56
const num = Number(v);
if (!isNaN(num)) {
setValue(num);
}

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.

P1 Nonfinite numbers persist

This guard only excludes NaN, so it still commits non-finite values. Number inputs can accept exponent notation such as 1e999; Number(v) becomes Infinity, and !isNaN(Infinity) is true, so setValue(Infinity) writes an invalid numeric value into the query tree. Query formatting later places numeric rule values directly into Elasticsearch term or range bodies, where Infinity cannot be represented as a valid JSON or Elasticsearch number. That can produce a broken or non-matching filter.

Suggested change
const num = Number(v);
if (!isNaN(num)) {
setValue(num);
}
const num = Number(v);
if (Number.isFinite(num)) {
setValue(num);
}

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review is ineligible. To be eligible to request a review, you need a paid Copilot license, or your organization must enable Copilot code review.

Comment on lines +54 to +56
if (!isNaN(num)) {
setValue(num);
}

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.

P1 Nonfinite values persist

This guard still commits non-finite numbers. A number input can accept exponent notation such as 1e999; Number(v) becomes Infinity, and !isNaN(Infinity) is true, so setValue(Infinity) writes an invalid numeric value into the query tree. Downstream query formatting cannot represent Infinity as a valid JSON or Elasticsearch number, so the generated numeric filter can become broken or non-matching.

Suggested change
if (!isNaN(num)) {
setValue(num);
}
if (Number.isFinite(num)) {
setValue(num);
}

karanh37
karanh37 previously approved these changes Aug 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — failed_checks (2026-08-26T18:24:36Z)

Blocked the queue: ui-checkstyle

@github-actions

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — manual (2026-08-26T19:52:27Z)

The entry left the queue before it was built, so no checks ran against it.

@github-actions

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — failed_checks (2026-08-27T00:03:18Z)

Blocked the queue: playwright-summary

@github-actions

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — failed_checks (2026-08-27T01:17:36Z)

Blocked the queue: ui-checkstyle

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review is ineligible. To be eligible to request a review, you need a paid Copilot license, or your organization must enable Copilot code review.

Comment on lines +54 to +56
if (!isNaN(num)) {
setValue(num);
}

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.

P1 Nonfinite Numbers Persist

This guard rejects NaN, but it still commits non-finite numbers. A number input can accept exponent notation such as 1e999; Number(v) becomes Infinity, and !isNaN(Infinity) is true, so the query-builder state receives a value that JSON and Elasticsearch cannot represent as a valid number. Downstream formatting places numeric rule values directly into query bodies, so this can serialize as null or produce a broken numeric filter. Use a finite-number check before calling setValue.

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review is ineligible. To be eligible to request a review, you need a paid Copilot license, or your organization must enable Copilot code review.

),
// RAQB passes the same FieldProps shape (including setField) to both
// field and operator renderers, so the same select component works for both.
renderOperator: (props) => <OMFieldSelect {...props} />,

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.

P1 Operator changes misroute

renderOperator still reuses the field selector path. The selector applies selections through the field-change callback, but this renderer is used for the rule operator slot. When a user changes an operator such as == to !=, the selected key can update the wrong slot or leave the operator unchanged, so the generated query can differ from the visible rule.

if (!asyncFetch) {
return;
}
const result = await asyncFetch(search);

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.

P1 Pagination stays unreachable

The async multiselect still keeps only result.values from the first asyncFetch(search) call and drops the pagination state. Enum and custom-property fetchers can expose more values through hasMore and later offsets, but this widget never stores that state or requests the next page. When a field has values beyond the first response page, users cannot browse or select those values unless their search text narrows the value into page one.

Comment on lines +54 to +56
if (!isNaN(num)) {
setValue(num);
}

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.

P1 Nonfinite numbers persist

This guard rejects NaN, but it still commits non-finite numbers. Number inputs can accept exponent notation such as 1e999; Number(v) becomes Infinity, and !isNaN(Infinity) is true, so setValue(Infinity) writes an invalid numeric value into the query tree. Downstream query formatting cannot represent Infinity as a valid JSON or Elasticsearch number, so the generated numeric filter can serialize incorrectly or stop matching.

Suggested change
if (!isNaN(num)) {
setValue(num);
}
if (Number.isFinite(num)) {
setValue(num);
}

@github-actions

github-actions Bot commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ UI Checkstyle passed — lint findings in changed files

🔍 ESLint findings in this PR's files — 0 error(s), 76 warning(s)

Errors block the build. Warnings do not yet — they are rules whose backlog is still
being worked down, listed so this PR does not add to it. See docs/ui-code-quality-gate.md.

0 error(s), 76 warning(s) across 17 changed file(s).

Count Rule
35 react-hooks/exhaustive-deps
8 sonarjs/cyclomatic-complexity
7 openmetadata-imports/no-lower-layer-page-imports
6 sonarjs/no-duplicate-string
5 openmetadata-imports/no-impure-pure-utils
4 openmetadata-imports/no-circular-imports
4 sonarjs/cognitive-complexity
3 sonarjs/expression-complexity
3 sonarjs/no-nested-conditional
1 react/no-danger
All findings
Location Rule Message
🟡 src/components/DataContract/ContractSemanticFormTab/ContractSemanticFormTab.tsx:99:5 react-hooks/exhaustive-deps React Hook useCallback has missing dependencies: 'form' and 'onChange'. Either include them or remove the dependency array. If 'onChange' changes too often, fin
🟡 src/components/DataContract/ContractSemanticFormTab/ContractSemanticFormTab.tsx:158:6 react-hooks/exhaustive-deps React Hook useEffect has a missing dependency: 'form'. Either include it or remove the dependency array.
🟡 src/components/DataContract/ContractSemanticFormTab/ContractSemanticFormTab.tsx:181:6 react-hooks/exhaustive-deps React Hook useEffect has a missing dependency: 'onChange'. Either include it or remove the dependency array. If 'onChange' changes too often, find the parent co
🟡 src/components/Explore/AdvanceSearchProvider/AdvanceSearchProvider.component.tsx:37:1 openmetadata-imports/no-lower-layer-page-imports Pages are route-level composition modules. Move the shared implementation/type to a lower layer instead of importing a page from here.
🟡 src/components/Explore/AdvanceSearchProvider/AdvanceSearchProvider.component.tsx:131:5 react-hooks/exhaustive-deps React Hook useMemo has a missing dependency: 'config'. Either include it or remove the dependency array.
🟡 src/components/Explore/AdvanceSearchProvider/AdvanceSearchProvider.component.tsx:160:6 react-hooks/exhaustive-deps React Hook useMemo has a missing dependency: 'config'. Either include it or remove the dependency array.
🟡 src/components/Explore/AdvanceSearchProvider/AdvanceSearchProvider.component.tsx:184:6 react-hooks/exhaustive-deps React Hook useEffect has a missing dependency: 'searchOutputType'. Either include it or remove the dependency array. If 'setConfig' needs the current value of '
🟡 src/components/Explore/AdvanceSearchProvider/AdvanceSearchProvider.component.tsx:204:9 react-hooks/exhaustive-deps The 'toggleModal' function makes the dependencies of useMemo Hook (at line 356) change on every render. Move it inside the useMemo callback. Alternatively, wrap
🟡 src/components/Explore/AdvanceSearchProvider/AdvanceSearchProvider.component.tsx:308:6 react-hooks/exhaustive-deps React Hook useEffect has a missing dependency: 'tabsInfo'. Either include it or remove the dependency array.
🟡 src/components/Explore/AdvanceSearchProvider/AdvanceSearchProvider.component.tsx:312:6 react-hooks/exhaustive-deps React Hook useEffect has a missing dependency: 'loadData'. Either include it or remove the dependency array.
🟡 src/components/Explore/AdvanceSearchProvider/AdvanceSearchProvider.component.tsx:325:6 react-hooks/exhaustive-deps React Hook useEffect has missing dependencies: 'handleReset' and 'loadTree'. Either include them or remove the dependency array.
🟡 src/components/MyData/Widgets/CuratedAssetsWidget/AdvancedAssetsFilterField/AdvancedAssetsFilterField.component.tsx:68:9 react-hooks/exhaustive-deps The 'selectedResource' logical expression could make the dependencies of useMemo Hook (at line 77) change on every render. To fix this, wrap the initialization
🟡 src/components/MyData/Widgets/CuratedAssetsWidget/AdvancedAssetsFilterField/AdvancedAssetsFilterField.component.tsx:68:9 react-hooks/exhaustive-deps The 'selectedResource' logical expression could make the dependencies of useMemo Hook (at line 135) change on every render. To fix this, wrap the initialization
🟡 src/components/MyData/Widgets/CuratedAssetsWidget/AdvancedAssetsFilterField/AdvancedAssetsFilterField.component.tsx:68:9 react-hooks/exhaustive-deps The 'selectedResource' logical expression could make the dependencies of useEffect Hook (at line 154) change on every render. To fix this, wrap the initializati
🟡 src/components/MyData/Widgets/CuratedAssetsWidget/AdvancedAssetsFilterField/AdvancedAssetsFilterField.component.tsx:121:5 react-hooks/exhaustive-deps React Hook useCallback has an unnecessary dependency: 'getExpandedResourceList'. Either exclude it or remove the dependency array. Outer scope values like 'getE
🟡 src/components/MyData/Widgets/CuratedAssetsWidget/AdvancedAssetsFilterField/AdvancedAssetsFilterField.component.tsx:124:37 react-hooks/exhaustive-deps React Hook useCallback received a function whose dependencies are unknown. Pass an inline function instead.
🟡 src/components/MyData/Widgets/CuratedAssetsWidget/AdvancedAssetsFilterField/AdvancedAssetsFilterField.component.tsx:172:6 react-hooks/exhaustive-deps React Hook useEffect has missing dependencies: 'config', 'fqn', 'onTreeUpdate', and 'queryFilter'. Either include them or remove the dependency array.
🟡 src/components/common/Form/JSONSchema/JsonSchemaWidgets/QueryBuilderWidget/QueryBuilderWidget.tsx:41:1 openmetadata-imports/no-lower-layer-page-imports Pages are route-level composition modules. Move the shared implementation/type to a lower layer instead of importing a page from here.
🟡 src/components/common/Form/JSONSchema/JsonSchemaWidgets/QueryBuilderWidget/QueryBuilderWidget.tsx:68:77 sonarjs/cyclomatic-complexity {"message":"Function has a complexity of 14 which is greater than 10 authorized.","cost":4,"secondaryLocations":[{"line":68,"column":76,"endLine":68,"endColumn"
🟡 src/components/common/Form/JSONSchema/JsonSchemaWidgets/QueryBuilderWidget/QueryBuilderWidget.tsx:130:5 react-hooks/exhaustive-deps React Hook useCallback has a missing dependency: 'config'. Either include it or remove the dependency array.
🟡 src/components/common/Form/JSONSchema/JsonSchemaWidgets/QueryBuilderWidget/QueryBuilderWidget.tsx:144:5 react-hooks/exhaustive-deps React Hook useMemo has a missing dependency: 'searchResults'. Either include it or remove the dependency array.
🟡 src/components/common/Form/JSONSchema/JsonSchemaWidgets/QueryBuilderWidget/QueryBuilderWidget.tsx:219:6 react-hooks/exhaustive-deps React Hook useCallback has missing dependencies: 'debouncedFetchEntityCount', 'defaultField', 'onTreeUpdate', and 'subField'. Either include them or remove the
🟡 src/components/common/Form/JSONSchema/JsonSchemaWidgets/QueryBuilderWidget/QueryBuilderWidget.tsx:223:6 react-hooks/exhaustive-deps React Hook useEffect has missing dependencies: 'onChangeSearchIndex' and 'resolvedSearchIndex'. Either include them or remove the dependency array.
🟡 src/components/common/Form/JSONSchema/JsonSchemaWidgets/QueryBuilderWidget/QueryBuilderWidget.tsx:229:6 react-hooks/exhaustive-deps React Hook useEffect has a missing dependency: 'loadDefaultValueInTree'. Either include it or remove the dependency array.
🟡 src/components/common/Form/JSONSchema/JsonSchemaWidgets/QueryBuilderWidget/QueryBuilderWidget.tsx:235:6 react-hooks/exhaustive-deps React Hook useEffect has a missing dependency: 'props'. Either include it or remove the dependency array. However, 'props' will change when any prop changes,
🟡 src/components/common/QueryBuilderWidgetV1/QueryBuilderWidgetV1.tsx:49:1 openmetadata-imports/no-lower-layer-page-imports Pages are route-level composition modules. Move the shared implementation/type to a lower layer instead of importing a page from here.
🟡 src/components/common/QueryBuilderWidgetV1/QueryBuilderWidgetV1.tsx:200:5 react-hooks/exhaustive-deps React Hook useCallback has a missing dependency: 'config'. Either include it or remove the dependency array.
🟡 src/components/common/QueryBuilderWidgetV1/QueryBuilderWidgetV1.tsx:210:7 sonarjs/expression-complexity Reduce the number of conditional operators (4) used in the expression (maximum allowed 3).
🟡 src/components/common/QueryBuilderWidgetV1/QueryBuilderWidgetV1.tsx:215:5 react-hooks/exhaustive-deps React Hook useMemo has a missing dependency: 'searchResults'. Either include it or remove the dependency array.
🟡 src/components/common/QueryBuilderWidgetV1/QueryBuilderWidgetV1.tsx:261:6 react-hooks/exhaustive-deps React Hook useEffect has a missing dependency: 'props'. Either include it or remove the dependency array. However, 'props' will change when any prop changes,
🟡 src/utils/AdvancedSearchClassBase.ts:48:1 openmetadata-imports/no-circular-imports This runtime import participates in a circular dependency. Extract the shared type/constant/utility or invert the dependency.
🟡 src/utils/AdvancedSearchClassBase.ts:280:16 sonarjs/no-duplicate-string Define a constant instead of duplicating this literal 3 times.
🟡 src/utils/AdvancedSearchClassBase.ts:611:51 sonarjs/no-duplicate-string Define a constant instead of duplicating this literal 3 times.
🟡 src/utils/AdvancedSearchClassBase.ts:946:26 sonarjs/no-duplicate-string Define a constant instead of duplicating this literal 4 times.
🟡 src/utils/AdvancedSearchClassBase.ts:1360:11 sonarjs/cyclomatic-complexity {"message":"Function has a complexity of 21 which is greater than 10 authorized.","cost":11,"secondaryLocations":[{"line":1360,"column":10,"endLine":1360,"endCo
🟡 src/utils/AdvancedSearchPureUtils.ts:16:1 openmetadata-imports/no-impure-pure-utils Pure utilities must not depend on React, UI, state, hooks, pages, or REST clients. Move orchestration/rendering out or move shared types to a lower layer.
🟡 src/utils/AdvancedSearchPureUtils.ts:17:1 openmetadata-imports/no-impure-pure-utils Pure utilities must not depend on React, UI, state, hooks, pages, or REST clients. Move orchestration/rendering out or move shared types to a lower layer.
🟡 src/utils/AdvancedSearchPureUtils.ts:18:1 openmetadata-imports/no-impure-pure-utils Pure utilities must not depend on React, UI, state, hooks, pages, or REST clients. Move orchestration/rendering out or move shared types to a lower layer.
🟡 src/utils/AdvancedSearchPureUtils.ts:214:23 sonarjs/cyclomatic-complexity {"message":"Function has a complexity of 11 which is greater than 10 authorized.","cost":1,"secondaryLocations":[{"line":214,"column":22,"endLine":214,"endColum
🟡 src/utils/AdvancedSearchUtils.tsx:33:1 openmetadata-imports/no-circular-imports This runtime import participates in a circular dependency. Extract the shared type/constant/utility or invert the dependency.
🟡 src/utils/AdvancedSearchUtils.tsx:36:1 openmetadata-imports/no-circular-imports This runtime import participates in a circular dependency. Extract the shared type/constant/utility or invert the dependency.
🟡 src/utils/AdvancedSearchUtils.tsx:140:15 react/no-danger Dangerous property 'dangerouslySetInnerHTML' found
🟡 src/utils/CuratedAssetsPureUtils.ts:20:1 openmetadata-imports/no-impure-pure-utils Pure utilities must not depend on React, UI, state, hooks, pages, or REST clients. Move orchestration/rendering out or move shared types to a lower layer.
🟡 src/utils/CuratedAssetsPureUtils.ts:20:1 openmetadata-imports/no-lower-layer-page-imports Pages are route-level composition modules. Move the shared implementation/type to a lower layer instead of importing a page from here.
🟡 src/utils/CuratedAssetsPureUtils.ts:48:10 sonarjs/cognitive-complexity Refactor this function to reduce its Cognitive Complexity from 16 to the 15 allowed.
🟡 src/utils/CuratedAssetsPureUtils.ts:48:10 sonarjs/cyclomatic-complexity {"message":"Function has a complexity of 12 which is greater than 10 authorized.","cost":2,"secondaryLocations":[{"line":48,"column":9,"endLine":48,"endColumn":
🟡 src/utils/CuratedAssetsUtils.test.tsx:16:1 openmetadata-imports/no-lower-layer-page-imports Pages are route-level composition modules. Move the shared implementation/type to a lower layer instead of importing a page from here.
🟡 src/utils/JSONLogicSearchClassBase.ts:45:1 openmetadata-imports/no-circular-imports This runtime import participates in a circular dependency. Extract the shared type/constant/utility or invert the dependency.
🟡 src/utils/JSONLogicSearchClassBase.ts:177:16 sonarjs/no-duplicate-string Define a constant instead of duplicating this literal 4 times.
🟡 src/utils/JSONLogicSearchClassBase.ts:784:42 sonarjs/cognitive-complexity Refactor this function to reduce its Cognitive Complexity from 19 to the 15 allowed.

… and 26 more. Run make ui-checkstyle-changed locally for the full list.


Fix locally (fast - only checks files changed in this branch):

make ui-checkstyle-changed

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review is ineligible. To be eligible to request a review, you need a paid Copilot license, or your organization must enable Copilot code review.

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review is ineligible. To be eligible to request a review, you need a paid Copilot license, or your organization must enable Copilot code review.

@gitar-bot

gitar-bot Bot commented Aug 27, 2026

Copy link
Copy Markdown
Code Review ⚠️ Changes requested 4 resolved / 6 findings

Migrates QueryBuilderWidgetV1 and its widgets from Ant Design to core-components with custom widget factories. Changes requested due to missing debounce on async select network fetches and dropped group labels in OMFieldSelect.

⚠️ Performance: Async select fires a network fetch on every keystroke (no debounce)

📄 openmetadata-ui/src/main/resources/ui/src/utils/queryBuilderWidgets/OMSelectWidget.tsx:74-88 📄 openmetadata-ui/src/main/resources/ui/src/utils/queryBuilderWidgets/OMSelectWidget.tsx:52-66

In OMSelectWidget.tsx the new async Select.ComboBox branch wires onInputChange={(v) => { loadAsync(v); }}, and loadAsync calls asyncFetch(search) which performs the /api/v1/search/aggregate request (owner/tag/tier autocomplete). There is no debounce/throttle, so every character typed issues a fresh backend request. The previous Ant Design RAQB widget debounced these lookups. This can produce a burst of aggregate queries per search, wasted work, and out-of-order responses where a slower earlier request overwrites items set by a later one (the last setItems to resolve wins, not the last request issued).

Suggested fix: debounce the input handler and/or guard against stale responses (e.g. track the latest request and ignore results from superseded searches).

Track the latest request and drop superseded responses; debounce onInputChange.
// debounce input + ignore stale responses
const latestReq = useRef(0);
const loadAsync = useCallback(async (search: string) => {
  if (!asyncFetch) return;
  const reqId = ++latestReq.current;
  const result = await asyncFetch(search);
  if (reqId !== latestReq.current) return; // stale
  setItems((result.values as ListItem[]).map((item) => ({
    id: String(item.value),
    label: String(item.title ?? item.value),
  })));
}, [asyncFetch]);
// then wrap the onInputChange call site in a debounce (e.g. lodash debounce, 300ms)
💡 Quality: OMFieldSelect drops group label (supportingText) from field picker

📄 openmetadata-ui/src/main/resources/ui/src/utils/queryBuilderWidgets/OMFieldSelect.tsx:24-27

In OMFieldSelect.tsx the mapping previously set supportingText: item.grouplabel, which surfaced the field's group/entity context in the field picker dropdown. This commit removes it, so the field/operator selector no longer shows the group label. If this is an intentional simplification it can be ignored, but it is a user-facing regression from the prior behavior where grouped fields displayed their group as supporting text. Confirm whether losing the group label is intended; if not, restore supportingText: item.grouplabel.

✅ 4 resolved
✅ Edge Case: OMDateWidget can't render ISO/Date values in native inputs

📄 openmetadata-ui/src/main/resources/ui/src/utils/queryBuilderWidgets/OMDateWidget.tsx:32-45
OMDateWidget binds value={String(value ?? '')} directly to a native <input type="date|datetime-local|time">. These native inputs only accept strictly-formatted strings (yyyy-MM-dd, yyyy-MM-ddTHH:mm, HH:mm). If RAQB provides a full ISO timestamp (e.g. 2024-01-01T00:00:00.000Z) or a Date object for a preexisting value, String(value) will not match the required format and the input will silently render empty, dropping the previously-saved date when a rule is edited. Consider normalizing value to the format expected by each type before passing it to the input.

✅ Bug: Async multiselect won't show preselected values as chips

📄 openmetadata-ui/src/main/resources/ui/src/utils/queryBuilderWidgets/OMMultiSelectWidget.tsx:58-72 📄 openmetadata-ui/src/main/resources/ui/src/utils/queryBuilderWidgets/OMMultiSelectWidget.tsx:77-91
In OMMultiSelectWidget, the effect that syncs selectedItems (from useListData) with the incoming valueArray only appends items it can find in allItems:

const item = allItems.find((i) => i.id === id);
if (item) {
  selectedItems.append(item);
}

and it is keyed only on [valueArray.join(',')].

For async fields (owner, tags, tier), listValues is empty at mount, so staticItems and the initial allItems are empty. When editing an existing filter that already has selected values, the sync effect runs once, fails to find the ids in the empty allItems, and appends nothing. loadAsync('') later populates allItems, but since allItems is not in the effect's dependency array the sync effect does not re-run — so the preselected values are never rendered as selected chips. This regresses the edit experience for async multiselect fields (a common case: editing a saved advanced-search / data-contract rule).

Suggested fix: include allItems in the effect dependencies, and/or fall back to a placeholder { id, label: id } when the item is not yet loaded so the selection is preserved.

✅ Edge Case: Async single-select may not display label for preselected value

📄 openmetadata-ui/src/main/resources/ui/src/utils/queryBuilderWidgets/OMSelectWidget.tsx:49-63
In OMSelectWidget, selectedKey is set to String(value) and the visible label is looked up from items. For async fields, items starts empty (listValues is empty) and is only populated after loadAsync('') resolves. If the resolved page does not include the currently-selected value, or before it resolves, the Select has a selectedKey with no matching item and will render without the human-readable label. Consider seeding items with the current value (e.g. { id: String(value), label: String(value) }) when it is not present in the loaded list, mirroring the fix needed for the multiselect widget.

✅ Edge Case: Selecting an async option re-triggers a fetch via onInputChange

📄 openmetadata-ui/src/main/resources/ui/src/utils/queryBuilderWidgets/OMSelectWidget.tsx:86-91
In the async Select.ComboBox branch of OMSelectWidget.tsx, onInputChange unconditionally calls loadAsync(v). When a user selects an option, react-aria ComboBox typically updates the input text to the selected item's label, which fires onInputChange again and triggers an extra asyncFetch call with the selected label as the search term. This is an unnecessary request and can also cause the items list to be replaced right after selection. Consider ignoring input changes that are not user-driven typing (react-aria provides trigger context via onInputChange's second argument in some versions) or comparing against the current selection before re-fetching.

🤖 Prompt for agents
Code Review: Migrates QueryBuilderWidgetV1 and its widgets from Ant Design to core-components with custom widget factories. Changes requested due to missing debounce on async select network fetches and dropped group labels in OMFieldSelect.

1. ⚠️ Performance: Async select fires a network fetch on every keystroke (no debounce)
   Files: openmetadata-ui/src/main/resources/ui/src/utils/queryBuilderWidgets/OMSelectWidget.tsx:74-88, openmetadata-ui/src/main/resources/ui/src/utils/queryBuilderWidgets/OMSelectWidget.tsx:52-66

   In `OMSelectWidget.tsx` the new async `Select.ComboBox` branch wires `onInputChange={(v) => { loadAsync(v); }}`, and `loadAsync` calls `asyncFetch(search)` which performs the `/api/v1/search/aggregate` request (owner/tag/tier autocomplete). There is no debounce/throttle, so every character typed issues a fresh backend request. The previous Ant Design RAQB widget debounced these lookups. This can produce a burst of aggregate queries per search, wasted work, and out-of-order responses where a slower earlier request overwrites `items` set by a later one (the last `setItems` to resolve wins, not the last request issued).
   
   Suggested fix: debounce the input handler and/or guard against stale responses (e.g. track the latest request and ignore results from superseded searches).

   Fix (Track the latest request and drop superseded responses; debounce onInputChange.):
   // debounce input + ignore stale responses
   const latestReq = useRef(0);
   const loadAsync = useCallback(async (search: string) => {
     if (!asyncFetch) return;
     const reqId = ++latestReq.current;
     const result = await asyncFetch(search);
     if (reqId !== latestReq.current) return; // stale
     setItems((result.values as ListItem[]).map((item) => ({
       id: String(item.value),
       label: String(item.title ?? item.value),
     })));
   }, [asyncFetch]);
   // then wrap the onInputChange call site in a debounce (e.g. lodash debounce, 300ms)

2. 💡 Quality: OMFieldSelect drops group label (supportingText) from field picker
   Files: openmetadata-ui/src/main/resources/ui/src/utils/queryBuilderWidgets/OMFieldSelect.tsx:24-27

   In `OMFieldSelect.tsx` the mapping previously set `supportingText: item.grouplabel`, which surfaced the field's group/entity context in the field picker dropdown. This commit removes it, so the field/operator selector no longer shows the group label. If this is an intentional simplification it can be ignored, but it is a user-facing regression from the prior behavior where grouped fields displayed their group as supporting text. Confirm whether losing the group label is intended; if not, restore `supportingText: item.grouplabel`.

Options

Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

if (!asyncFetch) {
return;
}
const result = await asyncFetch(search);

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.

P1 Pagination Still Missing

buildEnumAsyncFetch supports paging through an offset argument and returns hasMore for enum custom properties, but this widget only calls asyncFetch(search) and only stores result.values. When an enum custom-property multiselect has more than the first 100 matching values, later pages cannot be browsed or selected unless the user already knows enough text to narrow the value into page one.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@sonarqubecloud

Copy link
Copy Markdown

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe to test Add this label to run secure Github workflows on PRs skip-pr-checks Bypass PR metadata validation check UI UI specific issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate AntD QueryBuilder to Untitled UI

10 participants