Skip to content

fix(ui): clean up remaining legacy ui usage - #6140

Merged
sedghi merged 2 commits into
OHIF:masterfrom
dan-rukas:fix/small-legacy-ui-fixes
Jul 13, 2026
Merged

fix(ui): clean up remaining legacy ui usage#6140
sedghi merged 2 commits into
OHIF:masterfrom
dan-rukas:fix/small-legacy-ui-fixes

Conversation

@dan-rukas

@dan-rukas dan-rukas commented Jul 13, 2026

Copy link
Copy Markdown
Member

Context

These are the last two small legacy @ohif/ui component usages in the Viewer, cleaned up as part of the ongoing ui-next migration (Also see ContextMenuViewport PR here: #6008)

  • DataSourceSelector still imported Button + ButtonEnums from @ohif/ui.
  • ToolbarButtonNestedMenu (a ToolbarButton-based "More" nested-menu wrapper) was
    flagged by the migration audit as "used once, port to ui-next" — but investigation shows
    it has been dead code since 2020: commit cae54b0779 (Fix/update branch cherry pick #2039, 2020-09-14) removed its
    only usage from ViewerLayout/index.jsx when the toolbar moved to the ToolbarService
    button-section architecture. Nothing has imported it since; it was only carried forward
    by mechanical refactors (@ohif/ui import swap in feat: cornerstone3D stack and volume viewports #2787, .jsx.tsx in feat(ui): move to React 18 and base for using shadcn/ui #4174).
    It also imports ToolbarButton from @ohif/ui, an export the package no longer provides
    (it still exports Button/ButtonEnums, just not ToolbarButton). Because nothing imports
    the file, this has no runtime effect today — the module is never evaluated. It only means
    ToolbarButton would resolve to undefined, so the component couldn't render if something
    did use it. This just reinforces that removing the file is safe.

Changes & Results

  • DataSourceSelector.tsx — migrate the datasource button from the legacy @ohif/ui
    Button to the @ohif/ui-next Button:
    • import { Button, ButtonEnums } from '@ohif/ui'import { Button } from '@ohif/ui-next'
    • update the button props to the ui-next Button API (ButtonEnums is no longer needed).
    • onClick, className, and children are unchanged.
  • Delete extensions/default/src/ViewerLayout/ToolbarButtonNestedMenu.tsx — dead code
    (see Context). Its role (a nested "More" toolbar menu) is now served by the
    ToolbarService button sections + ui-next ToolButton / ToolButtonListDropDown,
    wired via getToolbarModule.tsxToolbar/ToolButtonListWrapper.tsx.

Effects

  • Removes 2 of the last legacy @ohif/ui importers from the default extension.
  • The deleted component was never rendered, so its removal has no runtime effect.

Before vs After

  • DataSourceSelector button (on /datasources):
  • NestedMenu removal: no visible change (dead code).

Testing

  • DataSourceSelector — the /datasources selector is an opt-in example route (not
    enabled by default). To exercise it locally: add
    '@ohif/extension-default.customizationModule.datasources' to your app config's
    customizationService array, run pnpm run dev, open http://localhost:3000/datasources,
    and confirm each datasource renders a button that navigates to /?datasources=<name> on
    click. (This config change is local-only — do not commit it.)
  • NestedMenu removal — dead-code removal only. Confirm the app builds and the toolbar,
    including any nested/"More" menus, behaves exactly as before. No source references the
    removed file (verified via path-import search, exported-name search, barrel check, and
    full-history pickaxe).

Checklist

PR

  • My Pull Request title is descriptive, accurate and follows the semantic-release
    format and guidelines.

Code

  • My code has been well-documented (function documentation, inline comments, etc.)

Public Documentation Updates

  • The documentation page has been updated as necessary for any public API additions or
    removals.

Tested Environment

  • OS: macOS Sequoia 15.7.4 (24G517)
  • Node version: 24.17.0
  • Browser: Google Chrome 149.0.7827.201 (Official Build) (arm64)

Summary by CodeRabbit

  • Style

    • Updated the data source selector button to use the newer interface style, including secondary styling and improved spacing.
  • Refactor

    • Removed the unused nested toolbar menu component.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@netlify

netlify Bot commented Jul 13, 2026

Copy link
Copy Markdown

Deploy Preview for ohif-dev ready!

Name Link
🔨 Latest commit 6ced4f5
🔍 Latest deploy log https://app.netlify.com/projects/ohif-dev/deploys/6a5507a7c2df790008b88a34
😎 Deploy Preview https://deploy-preview-6140--ohif-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

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

@dan-rukas
dan-rukas temporarily deployed to fork-pr-approval July 13, 2026 15:43 — with GitHub Actions Inactive
@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a58323a3-7030-4edf-ad5b-8a49e744911f

📥 Commits

Reviewing files that changed from the base of the PR and between 110b293 and 6ced4f5.

📒 Files selected for processing (2)
  • extensions/default/src/Panels/DataSourceSelector.tsx
  • extensions/default/src/ViewerLayout/ToolbarButtonNestedMenu.tsx
💤 Files with no reviewable changes (1)
  • extensions/default/src/ViewerLayout/ToolbarButtonNestedMenu.tsx

📝 Walkthrough

Walkthrough

Updates DataSourceSelector to use the @ohif/ui-next secondary button and removes the ToolbarButtonNestedMenu module.

Changes

Toolbar updates

Layer / File(s) Summary
Update toolbar button integration
extensions/default/src/Panels/DataSourceSelector.tsx, extensions/default/src/ViewerLayout/ToolbarButtonNestedMenu.tsx
DataSourceSelector imports Button from @ohif/ui-next, uses the secondary variant with updated spacing classes, and removes the nested menu component module.

Estimated code review effort: 1 (Trivial) | ~5 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the ui-next cleanup and removal of legacy @ohif/ui usage.
Description check ✅ Passed The description matches the template, with context, changes, testing steps, and a completed checklist.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@dan-rukas
dan-rukas requested a review from sedghi July 13, 2026 16:46
@sedghi
sedghi merged commit 03e17d7 into OHIF:master Jul 13, 2026
8 checks passed
dchansen06 pushed a commit to iCRcompany/OHIFViewer that referenced this pull request Jul 27, 2026
* Update button on DataSourceSelector

* Removed dead code ToolbarButtonNestedMenu, button spacing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants