Skip to content

Conversation

@rubaizmomin
Copy link

@rubaizmomin rubaizmomin commented Dec 21, 2025

User description

SUMMARY

Since react-dnd is no longer maintained, dnd-kit is being used as a replacement, as it is modern with hooks and is maintained regularly. With dnd-kit, I had two options: either make the dragIcon draggable or make the container draggable. I went with making the container draggable, as this was the previous behaviour.
Making the container draggable came with some challenges, as the container contains a delete button and an undo button (after deletion). These buttons have their listeners, like onClick, which caused an issue as we wrap the whole container with dnd-kit listeners. So, if we click on the delete button, it won't trigger, as all the events are captured by the dnd-kit listener and are never passed down to the delete and undo buttons. So for this, we used sensors to make the draggable action active based on the distance of drag, i.e., move the container by 5 px, to make the draggable action active, which would make the dnd listener catch that event otherwise, the events are passed to delete and undo and work as expected.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

BEFORE
before
AFTER
filterlist

TESTING INSTRUCTIONS

  1. Open a dashboard like world bank's data
  2. Click on the filter button on the top left
  3. Click on settings
  4. The left panel is the FilterTitleContainer
  5. Create new filters and you can drag and drop

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

CodeAnt-AI Description

Replace react-dnd with dnd-kit for native filter drag-and-drop

What Changed

  • Filter list drag-and-drop now uses dnd-kit, producing smoother drag transforms and transitions when reordering filters
  • Drag activation now requires a 5px move, so clicking the delete or undo buttons on a filter no longer gets blocked by drag listeners
  • Reordering calls the same rearrange callback and maintains stable keys so visual order updates correctly after drops

Impact

✅ Fewer accidental drag interceptions when clicking filter actions
✅ Smoother filter reordering animations
✅ Clickable delete and undo buttons during non-drag interactions

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

@codeant-ai-for-open-source
Copy link
Contributor

CodeAnt AI is reviewing your PR.


Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@bito-code-review
Copy link
Contributor

bito-code-review bot commented Dec 21, 2025

Code Review Agent Run #279352

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: 5a2c1ee..c8edbd5
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/DraggableFilter.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FilterTitleContainer.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

@dosubot dosubot bot added the change:frontend Requires changing the frontend label Dec 21, 2025
@codeant-ai-for-open-source codeant-ai-for-open-source bot added the size:M This PR changes 30-99 lines, ignoring generated files label Dec 21, 2025
@codeant-ai-for-open-source
Copy link
Contributor

Nitpicks 🔍

🔒 No security issues identified
⚡ Recommended areas for review

  • Drag listeners capture child clicks
    listeners and attributes from useSortable are spread onto the whole Container. This makes the entire container a drag target and can intercept clicks on interactive children (delete/undo buttons). Ensure drag activation is constrained or attach listeners only to a drag handle to avoid blocking child button events.

  • Drag index resolution
    handleDragEnd reads the start/end indices from active.data.current.sortable.index. That relies on draggable children populating that nested data shape. If the sortable data is missing (or the shape differs) the handler will no-op. A more robust approach is to derive indexes from active.id / over.id (which dnd-kit always sets) and compute positions from the filters array.

  • Prop forwarding
    The isDragging prop is provided to the styled Container but there is no shouldForwardProp defined for Container. That can cause the boolean isDragging to be forwarded to the DOM as an invalid attribute and trigger React warnings / unexpected behavior. Prefer preventing custom props from reaching DOM elements.

  • Sensors recreation & render stability
    sensors (and useSensor) are created inline on every render. This may be harmless but can cause unnecessary re-subscriptions / re-renders of dnd-kit internals. Consider memoizing sensors (or the handler) so they are stable between renders.


const FILTER_TYPE = 'FILTER';

const Container = styled.div<TitleContainerProps>`
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion: The isDragging prop is being forwarded to a native DOM

(the styled Container) which will render an unknown attribute on the DOM and cause React warnings or unexpected behavior; stop forwarding custom props to DOM by using shouldForwardProp or a transient prop name (like $isDragging). [possible bug]

Severity Level: Critical 🚨

Suggested change
const Container = styled.div<TitleContainerProps>`
const Container = styled('div', {
shouldForwardProp: propName => propName !== 'isDragging',
})<TitleContainerProps>`
Why it matters? ⭐

The Container currently receives a custom prop (isDragging) which would be forwarded to the underlying DOM

and cause React warnings or unexpected attributes in the DOM.
The proposed change to opt out forwarding (shouldForwardProp) or use a transient prop like $isDragging is correct and fixes a real issue. The improved code sample demonstrates the right approach by preventing the prop from reaching the DOM.

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/DraggableFilter.tsx
**Line:** 31:31
**Comment:**
	*Possible Bug: The `isDragging` prop is being forwarded to a native DOM <div> (the styled `Container`) which will render an unknown attribute on the DOM and cause React warnings or unexpected behavior; stop forwarding custom props to DOM by using `shouldForwardProp` or a transient prop name (like `$isDragging`).

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.

return;
}
const style = {
transform: CSS.Transform.toString(transform),
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion: transform returned by useSortable can be null/undefined; calling CSS.Transform.toString(transform) without guarding may produce an unexpected value — add a null-check so style.transform is undefined when there's no transform. [possible bug]

Severity Level: Critical 🚨

Suggested change
transform: CSS.Transform.toString(transform),
transform: transform ? CSS.Transform.toString(transform) : undefined,
Why it matters? ⭐

useSortable can return a null/undefined transform. Guarding the call avoids passing an invalid string (or "null") to the style.transform and ensures the style either contains a valid transform string or is undefined (so React omits it). This is a safe defensive change that prevents odd inline-style values.

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/DraggableFilter.tsx
**Line:** 62:62
**Comment:**
	*Possible Bug: `transform` returned by `useSortable` can be null/undefined; calling `CSS.Transform.toString(transform)` without guarding may produce an unexpected value — add a null-check so `style.transform` is `undefined` when there's no transform.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.

<Container ref={setNodeRef} style={style} isDragging={isDragging} {...listeners} {...attributes}>
<DragIcon
isDragging={isDragging}
alt="Move icon"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion: alt is not a valid attribute for SVG-based icon components and should be replaced with an accessible property such as aria-label (or a <title> inside the SVG) to provide screen-reader text; using alt may be ignored and hurts accessibility. [possible bug]

Severity Level: Critical 🚨

Suggested change
alt="Move icon"
aria-label="Move filter"
Why it matters? ⭐

alt is an attribute for , not for inline SVGs. Replacing it with aria-label (or including a <title> inside the SVG) is the correct accessibility fix. The suggested change improves screen-reader semantics and is appropriate for this icon component.

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/DraggableFilter.tsx
**Line:** 70:70
**Comment:**
	*Possible Bug: `alt` is not a valid attribute for SVG-based icon components and should be replaced with an accessible property such as `aria-label` (or a `<title>` inside the SVG) to provide screen-reader text; using `alt` may be ignored and hurts accessibility.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.

Comment on lines 170 to 172
const from: number = active?.data?.current?.sortable?.index;
const to: number = over?.data?.current?.sortable?.index;
if (from === undefined || to === undefined) return;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion: The drag end handler relies on active.data.current.sortable.index and over.data.current.sortable.index, which are only present if sortable children populate that data structure; those fields can be undefined and make rearrange a no-op. Compute source/target indices from active.id and over.id against the current filters array instead, which is more reliable and does not require sortable-specific data to be present. [possible bug]

Severity Level: Critical 🚨

Suggested change
const from: number = active?.data?.current?.sortable?.index;
const to: number = over?.data?.current?.sortable?.index;
if (from === undefined || to === undefined) return;
const activeId = active.id;
const overId = over.id;
if (activeId == null || overId == null) return;
const from = filters.indexOf(String(activeId));
const to = filters.indexOf(String(overId));
if (from === -1 || to === -1) return;
Why it matters? ⭐

This suggestion addresses a real reliability issue: the data.current.sortable.index payload isn't guaranteed unless the child sortable implementation populates it. Using active.id / over.id and resolving indices from the filters array is more robust and resilient to different sortable implementations. The change is straightforward and fixes a class of silent no-ops when data is missing.

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FilterTitleContainer.tsx
**Line:** 170:172
**Comment:**
	*Possible Bug: The drag end handler relies on `active.data.current.sortable.index` and `over.data.current.sortable.index`, which are only present if sortable children populate that `data` structure; those fields can be undefined and make rearrange a no-op. Compute source/target indices from `active.id` and `over.id` against the current `filters` array instead, which is more reliable and does not require sortable-specific data to be present.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.

@codeant-ai-for-open-source
Copy link
Contributor

CodeAnt AI finished reviewing your PR.

@bito-code-review
Copy link
Contributor

bito-code-review bot commented Dec 21, 2025

Code Review Agent Run #c78b2a

Actionable Suggestions - 0
Additional Suggestions - 1
  • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FilterTitleContainer.tsx - 1
    • Debug code in production · Line 169-169
      This console.log statement appears to be leftover debug code from the refactoring. It will execute on every drag end event, producing unwanted logs in production. Please remove it to keep the code clean.
Review Details
  • Files reviewed - 2 · Commit Range: c8edbd5..2168afc
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/DraggableFilter.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FilterTitleContainer.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

@rusackas rusackas requested a review from msyavuz December 23, 2025 18:45
@codeant-ai-for-open-source
Copy link
Contributor

CodeAnt AI is running Incremental review


Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@bito-code-review
Copy link
Contributor

bito-code-review bot commented Dec 27, 2025

Code Review Agent Run #fcece6

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: 2168afc..bf6266e
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/DraggableFilter.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FilterTitleContainer.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

@msyavuz
Copy link
Member

msyavuz commented Jan 25, 2026

@rubaizmomin I think this is in need of a rebase and cleanup to pass ci

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 size/L size:M This PR changes 30-99 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants