-
-
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
[core] Fix useTheme import change #134
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
import { describe } from 'yargs'; | ||
import { expect } from 'chai'; | ||
import createExtendSxProp from '../../src/createExtendSxProp'; | ||
|
||
describe('createExtendSxProp', () => { | ||
it('return the new copy of input', () => { | ||
const original = { color: 'red' }; | ||
expect(createExtendSxProp()(original)).to.not.equal(original); | ||
expect(createExtendSxProp()(original)).not.to.equal(original); | ||
expect(createExtendSxProp()(original)).to.deep.equal({ color: 'red' }); | ||
}); | ||
}); |
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
@@ -1,4 +1,7 @@ | ||||
import { useTheme } from '../zero-styled'; | ||||
import { useTheme } from '@pigment-css/react'; | ||||
|
||||
// This is intentional to make sure Pigment leaves the reference as-is. | ||||
console.log(useTheme); | ||||
|
||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the console.log intentional? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is part of the test to make sure we don't have the same issue that this PR fixes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see, got it. Can you add a comment that it's intentional? I am sure others will ask if they see console.log |
||||
export const Fade = React.forwardRef(function Fade(props, ref) { | ||||
const theme = useTheme(); | ||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -347,7 +347,10 @@ export const plugin = createUnplugin<PigmentOptions, true>((options) => { | |
if (id.endsWith('styles.css')) { | ||
return theme ? generateTokenCss(theme) : _code; | ||
} | ||
if (id.includes('pigment-css-react/theme')) { | ||
if ( | ||
id.includes('pigment-css-react/theme') || | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder what's There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. At some point, it was for local testing in workspaces. We can maybe clean this up separately. |
||
id.includes(`${process.env.RUNTIME_PACKAGE_NAME}/theme`) | ||
) { | ||
return generateThemeSource(theme); | ||
} | ||
return null; | ||
|
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.
Nice, fixed in the whole codebase: mui/material-ui@6fe271e, and in MUI X.