-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
replace useTheme with internal useGlobals #1265
Conversation
be12f71
to
2a51f4f
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Controlled tooltip is also broken :) It appears that Popover does not get And added a query for that in Popover: And now Select with controlled Popover and Controlled Tooltip works: My guess this is the same reason why in some cases Popover does not append itself to our theme provider root. (eg. recent ColorPicker issue, AppUI select issue) Maybe we can add data attribute to ThemeProvider for Popover to look for? |
Both fixed. It looks like
Edit: When we implement our custom Popover using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I have tried to test and toggle globals for everything that has more than a name change, and some random ones with only name change and everything seems to work fine for me (Windows + Chrome). Have also read the actual code changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Toasts get theme warning in Storybook. Probably because it's storybook.
LGTM.
I think it's expected, because we are calling a separate |
Changes
useTheme
hook, which meansThemeProvider
is now required.ThemeProvider
must always be used withchildren
.ownerDocument
option in ThemeProvider.useGlobals
hook in every component. Will be used for global setup (e.g. context for Future: Scoped sizing using Context #969 and useToaster) and side-effects (e.g. css imports and console warnings).Testing
Everything seems to work same as before when app is wrapped in
<ThemeProvider>
.When not wrapped, the warning is correctly displayed in dev environment.
Docs
Changeset added.
Migration guide updated: https://github.com/iTwin/iTwinUI/wiki/iTwinUI-react-v3-migration-guide#breaking-changes