Skip to content

fix(emotion): only warn about a missing theme when the fallback is actually used - #2675

Open
matyasf wants to merge 1 commit into
masterfrom
getTheme_fix
Open

fix(emotion): only warn about a missing theme when the fallback is actually used#2675
matyasf wants to merge 1 commit into
masterfrom
getTheme_fix

Conversation

@matyasf

@matyasf matyasf commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Move the "No theme provided for [InstUISettingsProvider], using default canvas theme." warning below the isBaseTheme early return so it only fires when the canvas fallback is actually used — previously it was a false positive whenever a valid theme was passed via the theme prop with no ancestor theme.
  • Collapse the currentTheme if/else into a hasAncestorTheme flag; make the InstUIProviderProps import type-only.

Test Plan

  • Render <InstUISettingsProvider theme={canvas}> (no ancestor provider) and confirm no console warning appears.
  • Render <InstUISettingsProvider themeOverride={{...}}> with no theme and confirm the warning still appears.

Fixes INSTUI-5142

🤖 Generated with Claude Code

…tually used

getTheme warned "No theme provided for [InstUISettingsProvider], using default `canvas`
theme." whenever there was no ancestor theme, even when the caller passed a perfectly valid
theme via the `theme` prop. That path returns early from the isBaseTheme branch and never
touches the canvas fallback, so the warning was a false positive on the most common usage.

Move the warning below the isBaseTheme early return so it only fires when we really do fall
back to canvas. Also collapse the currentTheme if/else into a hasAncestorTheme flag and make
the InstUIProviderProps import type-only.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@matyasf matyasf self-assigned this Aug 4, 2026
@matyasf
matyasf requested a review from HerrTopi August 4, 2026 09:07
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://instructure.design/pr-preview/pr-2675/

Built to branch gh-pages at 2026-08-04 09:10 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Visual regression report

⚠️ Changes detected.

Status Count
Unchanged 0
Changed 1
New 96
Removed 32

📊 View full report

Diff images (33)

alert.png — baseline no longer produced

avatar.png — baseline no longer produced

badge.png — baseline no longer produced

billboard.png — baseline no longer produced

breadcrumb.png — baseline no longer produced

button-and-derivatives.png — baseline no longer produced

byline.png — baseline no longer produced

calendar.png — baseline no longer produced

checkbox.png — baseline no longer produced

checkboxgroup.png — baseline no longer produced

colorpicker.png — baseline no longer produced

contextview.png — baseline no longer produced

custom-and-lucide-icons.png — baseline no longer produced

dateinput-dateinput2.png — baseline no longer produced

datetimeinput.png — baseline no longer produced

diff-demo.png — 6324 pixels differ

drilldown.png — baseline no longer produced

filedrop.png — baseline no longer produced

form-errors.png — baseline no longer produced

heading.png — baseline no longer produced

img.png — baseline no longer produced

link.png — baseline no longer produced

menu.png — baseline no longer produced

metric-pill-tag-timeselect-text.png — baseline no longer produced

options.png — baseline no longer produced

pagination.png — baseline no longer produced

progressbar.png — baseline no longer produced

select-simpleselect.png — baseline no longer produced

table.png — baseline no longer produced

tabs.png — baseline no longer produced

tooltip.png — baseline no longer produced

treebrowser.png — baseline no longer produced

view.png — baseline no longer produced

Baselines come from the visual-baselines branch. They refresh on every merge to master.

github-actions Bot pushed a commit that referenced this pull request Aug 4, 2026
@HerrTopi
HerrTopi requested a review from joyenjoyer August 4, 2026 09:47
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