Skip to content

feat: migrate DeleteModal to new component structure and update related tests#26561

Open
Rohit0301 wants to merge 2 commits intomainfrom
migrate-delete-modal-mui-switch
Open

feat: migrate DeleteModal to new component structure and update related tests#26561
Rohit0301 wants to merge 2 commits intomainfrom
migrate-delete-modal-mui-switch

Conversation

@Rohit0301
Copy link
Contributor

Describe your changes:

Fixes

collate PR - https://github.com/open-metadata/openmetadata-collate/pull/3186

I worked on ... because ...

Screenshot 2026-03-13 at 1 23 18 PM

Type of change:

  • Bug fix
  • Improvement
  • New feature
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: I updated the migration scripts or explained why it is not needed.

@Rohit0301 Rohit0301 self-assigned this Mar 17, 2026
@Rohit0301 Rohit0301 added the safe to test Add this label to run secure Github workflows on PRs label Mar 17, 2026
@Rohit0301 Rohit0301 requested a review from a team as a code owner March 17, 2026 17:53

case FieldTypes.SWITCH_MUI: {
case FieldTypes.UT_SWITCH: {
const { isDisabled, onChange, size, ...switchRest } =
Copy link

Choose a reason for hiding this comment

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

⚠️ Bug: Spread of switchRest can silently override explicit label prop

In formUtils.tsx:471, label is not destructured out of props as ToggleProps before creating switchRest. Since label is a valid ToggleProps property, if any caller passes label inside props, it will remain in switchRest and the spread {...switchRest} on line 481 will override the explicit label={isString(label) ? label : undefined} set on line 478 (due to JSX spread ordering — later props win).

Currently no callers pass label in props, but this is a latent bug that will silently break when someone does.

Suggested fix:

const { isDisabled, onChange, size, label: propsLabel, ...switchRest } =
  props as ToggleProps;

return (
  <Form.Item {...formProps} valuePropName="isSelected">
    <Toggle
      isDisabled={isDisabled}
      label={propsLabel ?? (isString(label) ? label : undefined)}
      size={size}
      onChange={onChange}
      {...switchRest}
    />
  </Form.Item>
);

Was this helpful? React with 👍 / 👎 | Reply gitar fix to apply this suggestion

@github-actions
Copy link
Contributor

github-actions bot commented Mar 17, 2026

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 64%
64.99% (57985/89217) 44.76% (30662/68501) 47.74% (9170/19205)

@github-actions
Copy link
Contributor

github-actions bot commented Mar 17, 2026

🟡 Playwright Results — all passed (15 flaky)

✅ 3389 passed · ❌ 0 failed · 🟡 15 flaky · ⏭️ 183 skipped

Shard Passed Failed Flaky Skipped
🟡 Shard 1 453 0 2 2
🟡 Shard 2 304 0 1 1
🟡 Shard 3 668 0 5 33
🟡 Shard 4 682 0 3 41
✅ Shard 5 672 0 0 73
🟡 Shard 6 610 0 4 33
🟡 15 flaky test(s) (passed on retry)
  • Features/CustomizeDetailPage.spec.ts › Database - customization should work (shard 1, 1 retry)
  • Flow/Metric.spec.ts › Verify Related Metrics Update (shard 1, 1 retry)
  • Pages/DataContracts.spec.ts › Create Data Contract and validate for Api Collection (shard 2, 1 retry)
  • Features/BulkImport.spec.ts › Database (shard 3, 1 retry)
  • Features/DataQuality/TestCaseIncidentPermissions.spec.ts › User with only VIEW cannot PATCH incidents (shard 3, 1 retry)
  • Features/DataQuality/TestCaseResultPermissions.spec.ts › User with only VIEW cannot PATCH results (shard 3, 1 retry)
  • Features/ImpactAnalysis.spec.ts › Verify column level upstream connections (shard 3, 1 retry)
  • Features/Permissions/GlossaryPermissions.spec.ts › Team-based permissions work correctly (shard 3, 1 retry)
  • Flow/PersonaFlow.spec.ts › Set default persona for team should work properly (shard 4, 1 retry)
  • Pages/Customproperties-part2.spec.ts › entityReferenceList shows item count, scrollable list, no expand toggle (shard 4, 1 retry)
  • Pages/Entity.spec.ts › Inactive Announcement create & delete (shard 4, 1 retry)
  • Pages/Glossary.spec.ts › Column dropdown drag-and-drop functionality for Glossary Terms table (shard 6, 1 retry)
  • Pages/Users.spec.ts › Permissions for table details page for Data Consumer (shard 6, 1 retry)
  • Pages/Users.spec.ts › Check permissions for Data Steward (shard 6, 1 retry)
  • VersionPages/EntityVersionPages.spec.ts › Directory (shard 6, 1 retry)

📦 Download artifacts

How to debug locally
# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip    # view trace

@gitar-bot
Copy link

gitar-bot bot commented Mar 19, 2026

Code Review ⚠️ Changes requested 0 resolved / 1 findings

Migrates DeleteModal to new component structure with updated tests, but the spread of switchRest in formUtils can silently override the explicit label prop, causing unexpected behavior.

⚠️ Bug: Spread of switchRest can silently override explicit label prop

📄 openmetadata-ui/src/main/resources/ui/src/utils/formUtils.tsx:471 📄 openmetadata-ui/src/main/resources/ui/src/utils/formUtils.tsx:478 📄 openmetadata-ui/src/main/resources/ui/src/utils/formUtils.tsx:481 📄 openmetadata-ui/src/main/resources/ui/src/pages/TagsPage/tagFormFields.tsx:179

In formUtils.tsx:471, label is not destructured out of props as ToggleProps before creating switchRest. Since label is a valid ToggleProps property, if any caller passes label inside props, it will remain in switchRest and the spread {...switchRest} on line 481 will override the explicit label={isString(label) ? label : undefined} set on line 478 (due to JSX spread ordering — later props win).

Currently no callers pass label in props, but this is a latent bug that will silently break when someone does.

Suggested fix
const { isDisabled, onChange, size, label: propsLabel, ...switchRest } =
  props as ToggleProps;

return (
  <Form.Item {...formProps} valuePropName="isSelected">
    <Toggle
      isDisabled={isDisabled}
      label={propsLabel ?? (isString(label) ? label : undefined)}
      size={size}
      onChange={onChange}
      {...switchRest}
    />
  </Form.Item>
);
🤖 Prompt for agents
Code Review: Migrates DeleteModal to new component structure with updated tests, but the spread of `switchRest` in formUtils can silently override the explicit `label` prop, causing unexpected behavior.

1. ⚠️ Bug: Spread of `switchRest` can silently override explicit `label` prop
   Files: openmetadata-ui/src/main/resources/ui/src/utils/formUtils.tsx:471, openmetadata-ui/src/main/resources/ui/src/utils/formUtils.tsx:478, openmetadata-ui/src/main/resources/ui/src/utils/formUtils.tsx:481, openmetadata-ui/src/main/resources/ui/src/pages/TagsPage/tagFormFields.tsx:179

   In `formUtils.tsx:471`, `label` is not destructured out of `props as ToggleProps` before creating `switchRest`. Since `label` is a valid `ToggleProps` property, if any caller passes `label` inside `props`, it will remain in `switchRest` and the spread `{...switchRest}` on line 481 will override the explicit `label={isString(label) ? label : undefined}` set on line 478 (due to JSX spread ordering — later props win).
   
   Currently no callers pass `label` in `props`, but this is a latent bug that will silently break when someone does.

   Suggested fix:
   const { isDisabled, onChange, size, label: propsLabel, ...switchRest } =
     props as ToggleProps;
   
   return (
     <Form.Item {...formProps} valuePropName="isSelected">
       <Toggle
         isDisabled={isDisabled}
         label={propsLabel ?? (isString(label) ? label : undefined)}
         size={size}
         onChange={onChange}
         {...switchRest}
       />
     </Form.Item>
   );

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing less information.

Comment with these commands to change:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@sonarqubecloud
Copy link

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant