Skip to content

fix(ui): preserve default modal resize handles when config is partial - #43806

Open
deepujain wants to merge 3 commits into
apache:masterfrom
deepujain:fix-43320-resizable-modal-handles
Open

fix(ui): preserve default modal resize handles when config is partial#43806
deepujain wants to merge 3 commits into
apache:masterfrom
deepujain:fix-43320-resizable-modal-handles

Conversation

@deepujain

Copy link
Copy Markdown

SUMMARY

Drill to detail, Drill by, and View as table modals pass a partial resizableConfig (min size and default height only). Modal replaced the full default config with that partial object, which dropped the enable map that restricts resize handles to bottom, bottom-right, and right.

With all handles enabled inside a draggable wrapper, resizing from top or left edges drifts and anchors from the wrong corner (#43320).

This change merges caller overrides with the default resizable config so handle guards stay in place unless explicitly overridden.

TESTING INSTRUCTIONS

  • npm test -- --testPathPattern=packages/superset-ui-core/src/components/Modal/Modal.test.tsx
  • Manual: open Drill to detail or Drill by, confirm only bottom/right resize handles appear and resizing does not drift.

ADDITIONAL INFORMATION

Fixes #43320

@bito-code-review

bito-code-review Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #249c7e

Actionable Suggestions - 0
Additional Suggestions - 1
  • superset-frontend/packages/superset-ui-core/src/components/Modal/Modal.tsx - 1
    • enable:false dropped in merge · Line 248-251
      `ResizableProps.enable` is typed `Enable | false`, so a caller can pass `enable: false` to disable all handles. The spread `{...defaults.enable, ...overrides.enable}` treats `false` as a no-op (spreading a boolean yields `{}`), silently keeping the default handles. The prior code passed `resizableConfig` through unchanged, so this is a regression. Guard the `false` case explicitly.
Review Details
  • Files reviewed - 2 · Commit Range: 753a9c3..753a9c3
    • superset-frontend/packages/superset-ui-core/src/components/Modal/Modal.test.tsx
    • superset-frontend/packages/superset-ui-core/src/components/Modal/Modal.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 an incremental AI Review.

  • /review full - 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

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.

🟢 Approval recommended

The change is scoped, matches the stated issue/root cause, and includes focused unit tests covering the new merge behavior.

Pull request overview

Fixes resizable/draggable modal “drift” by ensuring callers that pass a partial resizableConfig don’t accidentally discard the default resize-handle enable guards in the shared Modal component.

Changes:

  • Add mergeResizableConfig() helper to merge caller resizableConfig overrides with defaultResizableConfig, preserving default resize-handle restrictions unless explicitly overridden.
  • Update Modal to use the merged config via useMemo.
  • Add unit tests validating default-handle preservation and explicit enable overrides.
File summaries
File Description
superset-frontend/packages/superset-ui-core/src/components/Modal/Modal.tsx Merges default resizable settings with caller overrides to preserve resize-handle guards in draggable modals.
superset-frontend/packages/superset-ui-core/src/components/Modal/Modal.test.tsx Adds targeted tests for the new merge behavior to prevent regressions.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread superset-frontend/packages/superset-ui-core/src/components/Modal/Modal.tsx Outdated
@bito-code-review

Copy link
Copy Markdown
Contributor

Adding an explicit return type to mergeResizableConfig is a recommended practice for exported functions in TypeScript modules. It ensures the public API surface remains stable and prevents accidental breaking changes if the internal implementation or the return type of defaultResizableConfig evolves.

To implement this, you can import the ResizableProps or ModalProps type (depending on your project's type definitions) and use it as the return type annotation:

export function mergeResizableConfig(
  hideFooter: boolean | undefined,
  overrides: ModalProps['resizableConfig'] = {},
): ModalProps['resizableConfig'] {
  const defaults = defaultResizableConfig(hideFooter);
  // ... implementation
}

superset-frontend/packages/superset-ui-core/src/components/Modal/Modal.tsx

export function mergeResizableConfig(
  hideFooter: boolean | undefined,
  overrides: ModalProps['resizableConfig'] = {},
): ModalProps['resizableConfig'] {
  const defaults = defaultResizableConfig(hideFooter);
  if (!overrides || Object.keys(overrides).length === 0) {
    return defaults;
  }
  return {
    ...defaults,
    ...overrides,
    enable: {
      ...defaults.enable,
      ...overrides.enable,
    },
  };
}

Comment thread superset-frontend/packages/superset-ui-core/src/components/Modal/Modal.tsx Outdated
@deepujain
deepujain force-pushed the fix-43320-resizable-modal-handles branch from 753a9c3 to 6bdc758 Compare September 3, 2026 06:22
@bito-code-review

bito-code-review Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #81ab04

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: 6bdc758..a708e0c
    • superset-frontend/packages/superset-ui-core/src/components/Modal/Modal.test.tsx
    • superset-frontend/packages/superset-ui-core/src/components/Modal/Modal.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 an incremental AI Review.

  • /review full - 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

@deepujain
deepujain force-pushed the fix-43320-resizable-modal-handles branch from a708e0c to 8159ee0 Compare September 3, 2026 09:40
@bito-code-review

bito-code-review Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #5bdff6

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: 6a92dd2..8159ee0
    • superset-frontend/packages/superset-ui-core/src/components/Modal/Modal.test.tsx
    • superset-frontend/packages/superset-ui-core/src/components/Modal/Modal.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 an incremental AI Review.

  • /review full - 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

@codecov

codecov Bot commented Sep 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.66667% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 79.46%. Comparing base (d9b201d) to head (339fc44).

Files with missing lines Patch % Lines
...es/superset-ui-core/src/components/Modal/Modal.tsx 91.66% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master   #43806   +/-   ##
=======================================
  Coverage   79.45%   79.46%           
=======================================
  Files        2895     2895           
  Lines      168167   168175    +8     
  Branches    38995    38999    +4     
=======================================
+ Hits       133624   133633    +9     
+ Misses      32044    32043    -1     
  Partials     2499     2499           
Flag Coverage Δ
javascript 75.01% <91.66%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@deepujain
deepujain force-pushed the fix-43320-resizable-modal-handles branch 2 times, most recently from a4c36bb to f820ab1 Compare September 3, 2026 19:29
@deepujain

Copy link
Copy Markdown
Author

Fixed the current frontend type-check failure by making mergeResizableConfig return its actual non-nullable contract.

Validated on the pushed change:

  • npm test -- packages/superset-ui-core/src/components/Modal/Modal.test.tsx (9 tests passed)
  • npx oxlint --config oxlint.json --quiet packages/superset-ui-core/src/components/Modal/Modal.tsx packages/superset-ui-core/src/components/Modal/Modal.test.tsx
  • npm run plugins:build && npm run type

@deepujain
deepujain force-pushed the fix-43320-resizable-modal-handles branch from 49d9671 to cb209a8 Compare September 3, 2026 20:50
@bito-code-review

bito-code-review Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #7e9f9b

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: 39bfdfe..cb209a8
    • superset-frontend/packages/superset-ui-core/src/components/Modal/Modal.test.tsx
    • superset-frontend/packages/superset-ui-core/src/components/Modal/Modal.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 an incremental AI Review.

  • /review full - 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

@deepujain
deepujain force-pushed the fix-43320-resizable-modal-handles branch from cb209a8 to 53803d0 Compare September 4, 2026 02:18
@bito-code-review

bito-code-review Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #c9bc85

Actionable Suggestions - 0
Additional Suggestions - 1
  • superset-frontend/packages/superset-ui-core/src/components/Modal/Modal.tsx - 1
    • enable:true override dropped · Line 249-255
      `mergeResizableConfig` drops an explicit `enable: true`: `typeof true === 'object'` is false, so it falls to `{}` and returns the restricted `defaults.enable` (top/left/topLeft/topRight/bottomLeft all false). re-resizable's `Enable` type accepts a boolean (the repo's own test uses `enable: false`), so `enable: true` should enable all handles. No current caller passes it, but this is a latent gap in the new exported API.
Review Details
  • Files reviewed - 2 · Commit Range: 5c58d12..53803d0
    • superset-frontend/packages/superset-ui-core/src/components/Modal/Modal.test.tsx
    • superset-frontend/packages/superset-ui-core/src/components/Modal/Modal.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 an incremental AI Review.

  • /review full - 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

Drill and chart modals pass only min/defaultSize in resizableConfig, which
dropped the default enable map and exposed all handles, causing drift from
non-bottom-right corners. Merge overrides with defaults instead.

Fixes apache#43320
Guard ResizableProps.enable === false so partial merges do not silently
re-enable default handles. Add regression test and explicit return type.

Signed-off-by: Deepak Jain <deepujain@gmail.com>
The helper always returns a concrete config, so expose that contract to keep strict TypeScript checks from treating test and caller dereferences as optional.

Signed-off-by: Deepak Jain <deepujain@gmail.com>
@deepujain
deepujain force-pushed the fix-43320-resizable-modal-handles branch from 53803d0 to 339fc44 Compare September 4, 2026 16:23
@deepujain

Copy link
Copy Markdown
Author

The latest Bito additional suggestion about enable: true is not applicable to the current contract. ResizableProps['enable'] accepts Enable | false, and npm run type rejects true with TS2322. I left the implementation unchanged, rebased onto current master, and revalidated the 9 focused tests, changed-file oxlint, package declarations, and root type check.


const isDragged = () => !!document.querySelector('.react-draggable-dragged');

describe('mergeResizableConfig', () => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

These tests only call the extracted helper, so they still pass if CustomModal stops passing the merged configuration to Resizable; partial callers would then regain the guarded top/left handles. Could this render Modal with the partial caller config and assert the rendered handle set?

@bito-code-review

bito-code-review Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #c2cd37

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: a911da3..339fc44
    • superset-frontend/packages/superset-ui-core/src/components/Modal/Modal.test.tsx
    • superset-frontend/packages/superset-ui-core/src/components/Modal/Modal.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 an incremental AI Review.

  • /review full - 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

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Resizable modals resize from the wrong corner and drift while resizing

3 participants