fix(sentry): move @material-ui/core to peerDependencies to fix dark mode#7526
Closed
andreahlert wants to merge 1 commit intobackstage:mainfrom
Closed
fix(sentry): move @material-ui/core to peerDependencies to fix dark mode#7526andreahlert wants to merge 1 commit intobackstage:mainfrom
andreahlert wants to merge 1 commit intobackstage:mainfrom
Conversation
Contributor
Changed Packages
|
…ependencies These packages were declared as direct dependencies, which causes duplicate module instances with strict package managers like pnpm. The ThemeProvider from UnifiedThemeProvider ends up on one copy while the plugin's MUI components resolve to a separate copy with no theme context, falling back to the default light theme. Moving them to peerDependencies ensures the plugin always uses the host app's copy, sharing the same ThemeProvider context. Fixes backstage#6537 Signed-off-by: André Ahlert <andre@aex.partners>
c7faf26 to
dc8a5a2
Compare
This was referenced Feb 8, 2026
awanlin
requested changes
Feb 20, 2026
Contributor
awanlin
left a comment
There was a problem hiding this comment.
Hi @andreahlert, left a comment but this won't be the direction we want to go to solve this issue.
| '@backstage-community/plugin-sentry': patch | ||
| --- | ||
|
|
||
| Moved `@material-ui/core` and `@material-table/core` from `dependencies` to `peerDependencies` to fix dark mode rendering in strict package managers like pnpm. When declared as direct dependencies, these packages could resolve to a separate module instance, causing the plugin's MUI components to miss the ThemeProvider context and fall back to the default light theme. |
Contributor
There was a problem hiding this comment.
Backstage doesn't support pnpm, just Yarn, this should be a framework level change not something we are doing on a per-plugin basis, we'd need to change every plugin in the eco-system.
Alternatively, migrating this plugin to use Backstage UI (BUI) and removing MUI completly would be an approved way to work around this.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hey, I just made a Pull Request!
Fixes #6537
The sentry plugin declared
@material-ui/coreand@material-table/coreas direct dependencies. With strict package managers like pnpm, this creates a duplicate module instance where theThemeProviderfromUnifiedThemeProviderpopulates one copy's React Context, but the plugin's MUI components resolve to a separate copy with no theme context and fall back to the default light theme.I reproduced this locally by running
pnpm installon a minimal Backstage app with the sentry plugin. Two separate@material-ui/core@4.12.4directories appear under.pnpm/:@backstage/theme(provides ThemeProvider) -> copy 74b2@material-table/core(renders Paper) -> copy 74b2@backstage-community/plugin-sentry(Select, Grid, etc.) -> copy 7d94 (different instance)With npm/yarn this is masked by hoisting, but with pnpm's strict isolation it breaks. Other plugins like
tododon't have this problem because they don't declare@material-ui/coreas a direct dependency.Moving these to
peerDependenciesensures the plugin always uses the host app's copy.✔️ Checklist
Signed-off-byline in the message. (more info)