-
-
Notifications
You must be signed in to change notification settings - Fork 400
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
Fix media query issue #1523
base: master
Are you sure you want to change the base?
Fix media query issue #1523
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 |
---|---|---|
|
@@ -98,13 +98,16 @@ export default function jssNested(): Plugin { | |
container.addRule(selector, style[prop], {...options, selector}) | ||
} else if (isNestedConditional) { | ||
// Place conditional right after the parent rule to ensure right ordering. | ||
container | ||
.addRule(prop, {}, options) | ||
// Flow expects more options but they aren't required | ||
// And flow doesn't know this will always be a StyleRule which has the addRule method | ||
// $FlowFixMe[incompatible-use] | ||
// $FlowFixMe[prop-missing] | ||
.addRule(styleRule.key, style[prop], {selector: styleRule.selector}) | ||
const queue = container.prepareQueue() | ||
const addedRule = container.createRule(prop, {}, options) | ||
|
||
// Flow expects more options but they aren't required | ||
// And flow doesn't know this will always be a StyleRule which has the addRule method | ||
// $FlowFixMe[incompatible-use] | ||
// $FlowFixMe[prop-missing] | ||
addedRule.addRule(styleRule.key, style[prop], {selector: styleRule.selector}) | ||
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. Essentially all this is about ability to call an .addRule on a rule that implements ContainerRule without rendering anything (only adding to a queue) and then deploying the container rule as a next step. Is that correct? I think it would be much easier to find a better API that allows this if we had tests to verify the behavior, because right now trying things out without a test is way too hard. |
||
|
||
container.deployRule(addedRule, queue) | ||
} | ||
|
||
delete style[prop] | ||
|
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 that this code exposes too much internal API, it probably needs to be changed.
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.
yeah, definitely, need to find a cleaner way
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.
The logic with the queue is a mess :)
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.
It wasn't clean before, but now with queue from the instance and from an argument in deployRule, it became even worse