Skip to content

refactor(Filter components): migrate from react-dnd to dnd-kit#37445

Merged
rusackas merged 13 commits intoapache:masterfrom
LevisNgigi:use-dnd-kit
Mar 3, 2026
Merged

refactor(Filter components): migrate from react-dnd to dnd-kit#37445
rusackas merged 13 commits intoapache:masterfrom
LevisNgigi:use-dnd-kit

Conversation

@LevisNgigi
Copy link
Contributor

SUMMARY

This PR migrates DraggableFilter and related components from react-dnd to dnd-kit, replacing an unmaintained dependency with a modern, hooks-based drag-and-drop solution while preserving existing behavior.
The migration maintains container-level dragging, supports same-list reordering, and enables cross-list drag-and-drop via a shared DndContext.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

BEFORE:

2026-01-25.10-23-59.mp4

AFTER:

2026-01-26.09-13-46.mp4

TESTING INSTRUCTIONS

1)Open a dashboard .
2)Open the Filter Configuration / Customization sidebar.
3)Verify that filters can be:
4)Dragged to reorder within the same list
5)Dragged without interfering with Delete and Undo actions
6)Verify cross-list drag-and-drop behavior for dividers works as before.
7)Confirm that drag interactions work seamlessly.

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

@bito-code-review
Copy link
Contributor

bito-code-review bot commented Jan 26, 2026

Code Review Agent Run #82a83f

Actionable Suggestions - 0
Additional Suggestions - 8
  • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/DraggableFilter.test.tsx - 7
    • Test asserts rendering, not behavior · Line 56-72
      This test claims to verify 'identifies divider items correctly' but only checks rendering with `toBeInTheDocument()`. Per BITO.md rule [6262], tests should assert actual behavior logic, not just component presence. The component's divider identification affects internal data passed to @dnd-kit but isn't tested here, risking undetected bugs in divider detection.
    • Test asserts rendering, not behavior · Line 74-90
      Similar to the divider test, this only checks rendering despite claiming to test 'identifies non-divider items correctly'. BITO.md [6262] requires asserting the actual identification logic rather than just presence.
    • Test asserts rendering, not behavior · Line 92-107
      Test name suggests testing cross-list drop logic but only verifies rendering. BITO.md [6262] mandates testing claimed behavior, not just component display.
    • Test asserts rendering, not behavior · Line 110-125
      Only checks rendering despite test name implying customization divider logic testing. Violates BITO.md [6262] requirement for behavior assertion.
    • Test asserts rendering, not behavior · Line 128-144
      Test name suggests testing same-list drop logic but only verifies rendering. BITO.md [6262] requires testing the claimed drop behavior.
    • Test asserts rendering, not behavior · Line 146-162
      Only checks rendering despite implying cross-list drop logic testing. Violates BITO.md [6262] behavior assertion requirement.
    • Test asserts rendering, not behavior · Line 213-229
      Test claims to test 'detects cross-list drop correctly' but only checks rendering. BITO.md [6262] requires validating the detection logic.
  • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FilterConfigPane.test.tsx - 1
    • Test asserts rendering, not behavior · Line 69-79
      The 'drag and drop' test now only checks element presence, not behavior. Given useDnd: true in render, it should assert the onRearrange callback fires on drag events.
Review Details
  • Files reviewed - 7 · Commit Range: 3bfc337..68cd764
    • superset-frontend/cypress-base/cypress/e2e/dashboard/_skip.nativeFilters.test.ts
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/ConfigModalSidebar/ConfigModalSidebar.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/DraggableFilter.test.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/DraggableFilter.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FilterConfigPane.test.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FilterTitleContainer.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/ItemTitleContainer.tsx
  • Files skipped - 0
  • Tools
    • Eslint (Linter) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@dosubot dosubot bot added change:frontend Requires changing the frontend dashboard:editmode Related to te Dashboard edit mode labels Jan 26, 2026
@bito-code-review
Copy link
Contributor

bito-code-review bot commented Jan 26, 2026

Code Review Agent Run #799355

Actionable Suggestions - 0
Review Details
  • Files reviewed - 8 · Commit Range: b11c181..7b312a7
    • superset-frontend/cypress-base/cypress/e2e/dashboard/_skip.nativeFilters.test.ts
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/ConfigModalSidebar/ConfigModalSidebar.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/DraggableFilter.test.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/DraggableFilter.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FilterConfigPane.test.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FilterTitleContainer.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigModal.test.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/ItemTitleContainer.tsx
  • Files skipped - 0
  • Tools
    • Eslint (Linter) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@msyavuz
Copy link
Member

msyavuz commented Jan 29, 2026

I tested manually (videos are not playing) and cross list divider d&d does not work. Should it?

@LevisNgigi
Copy link
Contributor Author

I tested manually (videos are not playing) and cross list divider d&d does not work. Should it?

In the Filters and Config Modal? Below is the video.

2026-01-29.12-59-26.mp4

@msyavuz
Copy link
Member

msyavuz commented Jan 30, 2026

I think it might work but the dropping takes a while:

2026-01-30_14-40-43.mp4

@github-actions github-actions bot added i18n Namespace | Anything related to localization doc Namespace | Anything related to documentation plugins dependencies:npm packages labels Feb 4, 2026
@github-actions github-actions bot removed i18n Namespace | Anything related to localization doc Namespace | Anything related to documentation plugins dependencies:npm packages labels Feb 4, 2026
@netlify
Copy link

netlify bot commented Feb 4, 2026

Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 3f92d30
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/69830ae55303b800087aea93
😎 Deploy Preview https://deploy-preview-37445--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Feb 4, 2026

Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit c4d78d6
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/69a541a217d9190008ccee53
😎 Deploy Preview https://deploy-preview-37445--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@bito-code-review
Copy link
Contributor

bito-code-review bot commented Feb 16, 2026

Code Review Agent Run #c5da1d

Actionable Suggestions - 0
Review Details
  • Files reviewed - 8 · Commit Range: 819f013..be83d7b
    • superset-frontend/cypress-base/cypress/e2e/dashboard/_skip.nativeFilters.test.ts
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/ConfigModalSidebar/ConfigModalSidebar.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/DraggableFilter.test.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/DraggableFilter.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FilterConfigPane.test.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FilterTitleContainer.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigModal.test.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/ItemTitleContainer.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@bito-code-review
Copy link
Contributor

bito-code-review bot commented Feb 16, 2026

Code Review Agent Run #261891

Actionable Suggestions - 0
Additional Suggestions - 1
  • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigModal.test.tsx - 1
    • Duplicate utility function · Line 226-228
      The test defines a local sleep function that duplicates the one already exported from the test helpers. Consider using the imported sleep to avoid redundancy.
Review Details
  • Files reviewed - 8 · Commit Range: be83d7b..bad1cf6
    • superset-frontend/cypress-base/cypress/e2e/dashboard/_skip.nativeFilters.test.ts
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/ConfigModalSidebar/ConfigModalSidebar.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/DraggableFilter.test.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/DraggableFilter.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FilterConfigPane.test.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FilterTitleContainer.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigModal.test.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/ItemTitleContainer.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

Copy link
Contributor

@alexandrusoare alexandrusoare left a comment

Choose a reason for hiding this comment

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

LGTM - one curiosity though. Are we sure we covering all the cases where dnd-kit should be used? For example I know we also do drag and drop in SQL lab and on filters on explore.

@LevisNgigi
Copy link
Contributor Author

LGTM - one curiosity though. Are we sure we covering all the cases where dnd-kit should be used? For example I know we also do drag and drop in SQL lab and on filters on explore.

This PR is just the first step of the migration to dnd-kit. For now I focused specifically on drag-and-drop inside the config modals, mainly filters and chart customizations, since they share similar behavior. Other areas will be handled in follow up PRs like this one: #37880

@github-actions github-actions bot removed 🎪 be83d7b 🚦 running Environment be83d7b status: running 🎪 be83d7b 📅 2026-02-16T08-28 Environment be83d7b created at 2026-02-16T08-28 🎪 be83d7b 🤡 EnxDev Environment be83d7b requested by EnxDev 🎪 be83d7b 🌐 35.91.1.216:8080 Environment be83d7b URL: http://35.91.1.216:8080 (click to visit) labels Feb 18, 2026
Copy link
Contributor

@bito-code-review bito-code-review bot left a comment

Choose a reason for hiding this comment

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

Code Review Agent Run #8113c0

Actionable Suggestions - 2
  • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/ConfigModalSidebar/ConfigModalSidebar.tsx - 1
  • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigModal.tsx - 1
Additional Suggestions - 2
  • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FilterConfigPane.test.tsx - 1
    • Test coverage reduced for drag behavior · Line 69-79
      The 'drag and drop' test now only checks for presence of UI elements but does not verify that drag and drop actually triggers the onRearrange callback. According to BITO.md rule [6262], tests should assert the behavior they claim to test, not just rendering. Since @dnd-kit drag interactions are difficult to test with React Testing Library (as confirmed by library docs), consider either properly testing the behavior by mocking events or renaming the test to reflect its actual scope.
  • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigModal.test.tsx - 1
    • Test name mismatch · Line 579-579
      The test name 'rearranges three filters and deletes one of them' does not match the implementation, which only rearranges filters using keyboard navigation and asserts deleted: []. Since deletion is tested separately in other tests, update the name for clarity.
      Code suggestion
       @@ -579,1 +579,1 @@
      - test('rearranges three filters and deletes one of them', async () => {
      + test('rearranges three filters using keyboard navigation', async () => {
Review Details
  • Files reviewed - 9 · Commit Range: 0f6e867..c4d78d6
    • superset-frontend/cypress-base/cypress/e2e/dashboard/_skip.nativeFilters.test.ts
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/ConfigModalSidebar/ConfigModalSidebar.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/DraggableFilter.test.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/DraggableFilter.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FilterConfigPane.test.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FilterTitleContainer.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigModal.test.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigModal.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/ItemTitleContainer.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • Eslint (Linter) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

const overCustomizationIndex = customizationOrderedIds.findIndex(
id => id === over.id,
);

Copy link
Contributor

Choose a reason for hiding this comment

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

Unsafe property access in drag handler

Accessing active.data.current without checking if active.data exists could cause a runtime error if drag data is not set on the draggable item. Use optional chaining to safely access the nested property.

Code suggestion
Check the AI-generated fix before applying
 -      );
 -      const activeData = active.data.current;
 -      if (
 -        activeFilterIndex === -1 &&
 -        activeCustomizationIndex === -1 &&
 +      );
 +      const activeData = active.data?.current;
 +      if (
 +        activeFilterIndex === -1 &&
 -        activeCustomizationIndex === -1 &&
 +        activeCustomizationIndex === -1 &&

Code Review Run #8113c0


Should Bito avoid suggestions like this for future reviews? (Manage Rules)

  • Yes, avoid them

Comment on lines +463 to +476
const debouncedHandleErroredItems = useMemo(
() =>
debounce(() => {
setSaveAlertVisible(false);
modalSaveLogic.handleErroredItems();
setFormValuesVersion(prev => prev + 1);
}, Constants.SLOW_DEBOUNCE),
[modalSaveLogic],
[modalSaveLogic, setSaveAlertVisible],
);

const handleValuesChange = useCallback(() => {
setFormValuesVersion(prev => prev + 1);
debouncedErrorHandling();
}, [debouncedErrorHandling]);
const handleValuesChange = useMemo(
() => debouncedHandleErroredItems,
[debouncedHandleErroredItems],
);
Copy link
Contributor

Choose a reason for hiding this comment

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

Debounced state update causes UI lag

This refactoring delays the formValuesVersion increment by 500ms, causing itemTitles (used in sidebar) and the collapse component reset to lag behind form changes, leading to stale UI display.

Code suggestion
Check the AI-generated fix before applying
Suggested change
const debouncedHandleErroredItems = useMemo(
() =>
debounce(() => {
setSaveAlertVisible(false);
modalSaveLogic.handleErroredItems();
setFormValuesVersion(prev => prev + 1);
}, Constants.SLOW_DEBOUNCE),
[modalSaveLogic],
[modalSaveLogic, setSaveAlertVisible],
);
const handleValuesChange = useCallback(() => {
setFormValuesVersion(prev => prev + 1);
debouncedErrorHandling();
}, [debouncedErrorHandling]);
const handleValuesChange = useMemo(
() => debouncedHandleErroredItems,
[debouncedHandleErroredItems],
);
const debouncedHandleErroredItems = useMemo(
() =>
debounce(() => {
setSaveAlertVisible(false);
modalSaveLogic.handleErroredItems();
}, Constants.SLOW_DEBOUNCE),
[modalSaveLogic, setSaveAlertVisible],
[debouncedHandleErroredItems],
);
const handleValuesChange = useCallback(
() => {
setFormValuesVersion(prev => prev + 1);
debouncedHandleErroredItems();
}, [debouncedHandleErroredItems],
);

Code Review Run #8113c0


Should Bito avoid suggestions like this for future reviews? (Manage Rules)

  • Yes, avoid them

Copy link
Contributor

@bito-code-review bito-code-review bot left a comment

Choose a reason for hiding this comment

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

Code Review Agent Run #8dcabb

Actionable Suggestions - 1
  • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/DraggableFilter.tsx - 1
Review Details
  • Files reviewed - 1 · Commit Range: c4d78d6..809b070
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/DraggableFilter.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

Copy link
Member

@rusackas rusackas left a comment

Choose a reason for hiding this comment

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

Codeowner stamp incoming!!

@rusackas rusackas merged commit 3e10ab7 into apache:master Mar 3, 2026
77 checks passed
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 dashboard:editmode Related to te Dashboard edit mode 🎪 🔒 showtime-blocked size/XL 🎪 ⌛ 48h Environment expires after 48 hours (default)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants