Skip to content

refactor(Select): Migrate Select component to Ant Design 5 #32514

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 119 commits into from
Apr 8, 2025

Conversation

msyavuz
Copy link
Member

@msyavuz msyavuz commented Mar 5, 2025

SUMMARY

Migrate Select component to Ant Design 5. Simplifying the Select component in the process is a secondary objective.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before:
image
After:
image

Before:
image
After:
image

Before:
image
After:
image

TESTING INSTRUCTIONS

Run the testing suite and do visual testing.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

Copy link

korbit-ai bot commented Mar 5, 2025

Based on your review schedule, I'll hold off on reviewing this PR until it's marked as ready for review. If you'd like me to take a look now, comment /korbit-review.

Your admin can change your review schedule in the Korbit Console

@msyavuz
Copy link
Member Author

msyavuz commented Mar 5, 2025

/korbit-review

Copy link

@korbit-ai korbit-ai bot left a comment

Choose a reason for hiding this comment

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

Review by Korbit AI

Korbit automatically attempts to detect when you fix issues in new commits.
Category Issue Fix Detected
Functionality Typo in property access causing undefined value ▹ view
Functionality Unsafe non-null assertion in mutator call ▹ view
Performance Ineffective text truncation ▹ view
Functionality Incorrect class name for tag close icon ▹ view
Files scanned
File Path Reviewed
superset-frontend/src/components/Select/constants.ts
superset-frontend/src/filters/components/TimeGrain/types.ts
superset-frontend/src/filters/components/TimeColumn/types.ts
superset-frontend/packages/superset-ui-chart-controls/src/components/Select.tsx
superset-frontend/plugins/plugin-chart-cartodiagram/src/util/controlPanelUtil.tsx
superset-frontend/src/components/Select/CustomTag.tsx
superset-frontend/src/explore/components/controls/SelectAsyncControl/index.tsx
superset-frontend/src/components/Select/styles.tsx
superset-frontend/src/components/Select/types.ts
superset-frontend/src/components/Select/utils.tsx
superset-frontend/src/filters/components/Select/SelectFilterPlugin.tsx
superset-frontend/src/components/TableSelector/index.tsx
superset-frontend/src/explore/components/controls/ColorSchemeControl/index.tsx
superset-frontend/src/explore/components/PropertiesModal/index.tsx
superset-frontend/src/SqlLab/components/SaveDatasetModal/index.tsx
superset-frontend/src/components/Select/AsyncSelect.tsx
superset-frontend/src/components/Select/Select.tsx

Explore our documentation to understand the languages and file types we support and the files we ignore.

Need a new review? Comment /korbit-review on this PR and I'll review your latest changes.

Korbit Guide: Usage and Customization

Interacting with Korbit

  • You can manually ask Korbit to review your PR using the /korbit-review command in a comment at the root of your PR.
  • You can ask Korbit to generate a new PR description using the /korbit-generate-pr-description command in any comment on your PR.
  • Too many Korbit comments? I can resolve all my comment threads if you use the /korbit-resolve command in any comment on your PR.
  • On any given comment that Korbit raises on your pull request, you can have a discussion with Korbit by replying to the comment.
  • Help train Korbit to improve your reviews by giving a 👍 or 👎 on the comments Korbit posts.

Customizing Korbit

  • Check out our docs on how you can make Korbit work best for you and your team.
  • Customize Korbit for your organization through the Korbit Console.

Feedback and Support

@@ -69,7 +55,7 @@ export const customTagRender = (props: CustomTagProps) => {
target.tagName === 'svg' ||
target.tagName === 'path' ||
(target.tagName === 'span' &&
target.className.includes('ant-tag-close-icon'))
target.className.includes('antd5-tag-close-icon'))
Copy link

Choose a reason for hiding this comment

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

Incorrect class name for tag close icon category Functionality

Tell me more
What is the issue?

The class name check for the close icon is incorrect. Ant Design v5 uses 'ant-tag-close-icon' class, not 'antd5-tag-close-icon'.

Why this matters

This will cause the click propagation prevention to fail when clicking the close icon, leading to unexpected behavior where the dropdown opens when attempting to remove a tag.

Suggested change ∙ Feature Preview

Update the class name check to use the correct Ant Design v5 class:

target.className.includes('ant-tag-close-icon')

Report a problem with this comment

💬 Chat with Korbit by mentioning @korbit-ai.

@sadpandajoe sadpandajoe added review:checkpoint Last PR reviewed during the daily review standup review:draft labels Mar 5, 2025
@rusackas
Copy link
Member

rusackas commented Mar 5, 2025

@michael-s-molina and @geido put a lot of work into consolidating numerous Select modules into one Super-Duper-Select. I would check with either/both of them regarding any simplification efforts, just in case there are use cases around the intricacies. Of course if AntD now includes the functionality we built around it previously, or there are unnecessary style layers, then yes, let's go as "vanilla" as we can!

@sadpandajoe sadpandajoe removed the review:checkpoint Last PR reviewed during the daily review standup label Mar 6, 2025
@msyavuz msyavuz changed the base branch from master to template_less March 13, 2025 17:40
@geido geido requested a review from kgabryje as a code owner April 7, 2025 11:01
@dosubot dosubot bot added change:frontend Requires changing the frontend frontend:refactor Related to refactoring the frontend frontend:refactor:antd5 labels Apr 7, 2025
@geido geido force-pushed the msyavuz/refactor/migrate-select branch from 101a0d2 to 3996d69 Compare April 7, 2025 11:05
Copy link

korbit-ai bot commented Apr 7, 2025

I was unable to post the issues I found. This could be because a force push or squash has changed the commit history since I scanned this pull request. You can get another review by commenting /korbit-review.

@msyavuz msyavuz force-pushed the msyavuz/refactor/migrate-select branch from 1713b6e to 353e36c Compare April 7, 2025 17:11
@msyavuz msyavuz marked this pull request as draft April 7, 2025 18:38
@msyavuz msyavuz marked this pull request as ready for review April 7, 2025 18:38
Copy link

@korbit-ai korbit-ai bot left a comment

Choose a reason for hiding this comment

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

Review by Korbit AI

Korbit automatically attempts to detect when you fix issues in new commits.
Category Issue Status
Performance Arbitrary Virtual Scrolling Threshold ▹ view ✅ Fix detected
Performance Inefficient Deep Clone of Entire Metadata ▹ view 🧠 Not in scope
Readability Unreliable Fixed Wait Time ▹ view 🧠 Incorrect
Readability Complex DOM manipulation needs inline explanation ▹ view 🧠 Not in scope
Readability Unexplained magic numbers in padding ▹ view 🧠 Not in standard
Design Avoid wildcard exports for better API clarity ▹ view 🧠 Not in scope
Files scanned
File Path Reviewed
superset-frontend/src/components/Select/index.tsx
superset-frontend/src/types/TagType.ts
superset-frontend/src/components/Spin/index.tsx
superset-frontend/src/components/index.ts
superset-frontend/src/components/Select/constants.ts
superset-frontend/src/filters/components/TimeGrain/types.ts
superset-frontend/src/filters/components/TimeColumn/types.ts
superset-frontend/src/components/IndeterminateCheckbox/index.tsx
superset-frontend/src/features/reports/ReportModal/styles.tsx
superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/DatasetSelect.tsx
superset-frontend/src/components/Select/CustomTag.tsx
superset-frontend/src/explore/components/controls/SelectAsyncControl/index.tsx
superset-frontend/src/GlobalStyles.tsx
superset-frontend/src/components/Icons/AntdEnhanced.tsx
superset-frontend/cypress-base/cypress/e2e/explore/utils.ts
superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FilterTitleContainer.tsx
superset-frontend/src/components/CronPicker/CronPicker.tsx
superset-frontend/cypress-base/cypress/utils/index.ts
superset-frontend/src/components/Select/styles.tsx
superset-frontend/src/dashboard/actions/nativeFilters.ts
superset-frontend/src/features/databases/DatabaseModal/DatabaseConnectionForm/EncryptedField.tsx
superset-frontend/src/explore/components/controls/SelectControl.jsx
superset-frontend/src/components/Select/types.ts
superset-frontend/src/components/Select/Select.stories.tsx
superset-frontend/src/features/tags/TagModal.tsx
superset-frontend/src/filters/components/Select/SelectFilterPlugin.tsx
superset-frontend/src/components/TableSelector/index.tsx
superset-frontend/src/components/Select/utils.tsx
superset-frontend/src/explore/components/PropertiesModal/index.tsx
superset-frontend/src/components/DatabaseSelector/index.tsx
superset-frontend/src/pages/ChartCreation/index.tsx
superset-frontend/src/SqlLab/components/SaveDatasetModal/index.tsx
superset-frontend/src/features/databases/DatabaseModal/styles.ts
superset-frontend/src/explore/components/controls/ColorSchemeControl/index.tsx
superset-frontend/src/explore/components/controls/DndColumnSelectControl/ColumnSelectPopover.tsx
superset-frontend/src/explore/components/controls/MetricControl/AdhocMetricEditPopover/index.jsx
superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent/index.tsx
superset-frontend/src/components/Select/AsyncSelect.tsx
superset-frontend/cypress-base/cypress/e2e/dashboard/utils.ts
superset-frontend/src/components/Select/Select.tsx
superset-frontend/cypress-base/cypress/support/directories.ts
superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FiltersConfigForm.tsx

Explore our documentation to understand the languages and file types we support and the files we ignore.

Need a new review? Comment /korbit-review on this PR and I'll review your latest changes.

Korbit Guide: Usage and Customization

Interacting with Korbit

  • You can manually ask Korbit to review your PR using the /korbit-review command in a comment at the root of your PR.
  • You can ask Korbit to generate a new PR description using the /korbit-generate-pr-description command in any comment on your PR.
  • Too many Korbit comments? I can resolve all my comment threads if you use the /korbit-resolve command in any comment on your PR.
  • On any given comment that Korbit raises on your pull request, you can have a discussion with Korbit by replying to the comment.
  • Help train Korbit to improve your reviews by giving a 👍 or 👎 on the comments Korbit posts.

Customizing Korbit

  • Check out our docs on how you can make Korbit work best for you and your team.
  • Customize Korbit for your organization through the Korbit Console.

Feedback and Support

Comment on lines +23 to +26
export * from './types';
export * from './styles';
export * from './CustomTag';
export * from './constants';

This comment was marked as resolved.

@@ -122,7 +122,7 @@ export const setInScopeStatusOfFilters =
// need to update native_filter_configuration in the dashboard metadata
const metadata = cloneDeep(getState().dashboardInfo.metadata);

This comment was marked as resolved.

Comment on lines 70 to 72
& .btn-group > .btn {
padding: 5px 10px 6px;
}

This comment was marked as resolved.

Comment on lines +154 to +157
const nativeInputValueSetter = Object.getOwnPropertyDescriptor(
window.HTMLInputElement.prototype,
'value',
)?.set;

This comment was marked as resolved.

tokenSeparators={tokenSeparators}
virtual={fullSelectOptions.length > 20}

This comment was marked as resolved.

@msyavuz
Copy link
Member Author

msyavuz commented Apr 8, 2025

I had to do a ugly workaround for a bug in rc-table which sets removeButton role to "tab". I opened up the issue and the pr for fixing it here:
react-component/tabs#809

isEqual as utilsIsEqual,
getSuffixIcon,
sortComparatorWithSearchHelper,
VIRTUAL_THRESHOLD,
Copy link
Member

Choose a reason for hiding this comment

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

Should this part of constants? And maybe SELECT_ALL_VALUE too?

@@ -121,9 +124,11 @@ const Select = forwardRef(
getPopupContainer,
oneLine,
maxTagCount: propsMaxTagCount,
virtual = undefined,
virtualThreshold = VIRTUAL_THRESHOLD,
Copy link
Member

Choose a reason for hiding this comment

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

Any reasons to pass this as a prop? I think if someone wanted to enable the virtual mode they can just do it through the virtual prop.

* the options will be virtualized.
* If the virtual prop is set this will be ignored.
*/
virtualThreshold?: number;
Copy link
Member

Choose a reason for hiding this comment

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

As I wrote above I don't think we need a prop for this

? mutator(response.json, value)
: response.json.result;
setOptions(data);
if (value) {
Copy link
Member

Choose a reason for hiding this comment

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

@msyavuz not sure if this got missed but it seems we might still ignoring null values with this check which should be valid.

Copy link
Member

@geido geido left a comment

Choose a reason for hiding this comment

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

A few nits but looking good overall!

@msyavuz msyavuz merged commit b835478 into apache:template_less Apr 8, 2025
41 checks passed
@msyavuz msyavuz deleted the msyavuz/refactor/migrate-select branch April 8, 2025 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
change:frontend Requires changing the frontend dependencies:npm frontend:refactor:antd5 frontend:refactor Related to refactoring the frontend size/XXL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants