-
-
Notifications
You must be signed in to change notification settings - Fork 399
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
[react-jss] Remove inject option #934
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
fa86f78
Update to new react context for the jss context
d83f47f
Fixed types
75d8be3
Fix some tests
83ca4ab
Remove unnecessary cloning
ef2044f
Merge branch 'master' into react-jss/jss-context
6c4c60b
Fix JssProvider
5d85697
Merge remote-tracking branch 'origin/react-jss/jss-context' into reac…
8d9135f
Update logic of merging context
d27982c
Fix a few issues and tests
ee5b797
Make getTheme non public
d954612
Update warning inside JssProvider
aefff36
Remove duplicate beforeEach
440a575
Update size-snapshot
689904d
Fix a few bugs
8640e41
Remove inject option
dbcad68
Merge branch 'react-jss/update' into react-jss/remove-inject-option
a222ca0
Fix
7c44dde
Always inject the theme
3069d30
Only inject theme when injectTheme is true
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ export const JssProvider: React.ComponentType<{ | |
type Omit<T, K> = Pick<T, Exclude<keyof T, K>> | ||
type Options = { | ||
index?: number | ||
inject?: Array<'classes' | 'theme' | 'sheet'> | ||
injectTheme?: boolean | ||
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. so we can remove injectTheme completely? 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. No, someone might still want to subscribe to the theme even though he has a styles object |
||
jss?: Jss | ||
} & StyleSheetFactoryOptions | ||
|
||
|
This file contains 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
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.
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.
I think we can also get rid of isThemingEnabled, because if a theme is on the context, its weird it would be implicitely depending on styles being a function
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.
No, we still need to do some checks based on
isThemingEnabled
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.
Lets revisit them, I think we can get rid of it.
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.
We still need this to decide which theme we are using.
When someone passed a function as the styles, we use the theme prop.
Because the user still might pass
injectTheme: true
which would subscribe to the theme, even though the styles are not theme dependent, we would create additional stylesheets.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.
I think isThemingEnabled logic needs to be different, e.g.
shouldSubscribeTheme = options.injectTheme || stylesIsfunction
and rendering of styles just based on stylesIsFunction