Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upgetDynamicStyles() includes Observable rules #930
Comments
|
Can you please explain why this is unexpected? Observables are a form of dynamic styles. |
|
As per the documentation (https://cssinjs.org/js-api?v=v9.8.7#extract-dynamic-styles ),
. |
|
Or we should fix the problem in react-jss by adding a check for fn values |
|
Yeah, we should fix the docs and fix react-jss by adding a check. Is there a use case for observables inside react-jss currently? |
|
Same use case as with core, being able to stream the values from thee outside, for e.g. a complex animation using rx utils |
|
But this would break as soon as you render two different instances of the same component. |
|
Why would it break? We don't reuse dynamic style between elements. |
|
Yeah, but the observable would be the same. You can only have an animation which is shared between all components |
|
ToDos for this:
|
|
True that. I wonder if we should support a fn value that returns an observable. |
|
Alternatively separate components per animation might be also acceptable. |
|
Please no. This would just create more confusion. We would also need a way to pass the observable then back to the user. We should definitely document the problem with observables and react-jss somewhere. |
|
yeah, the user would have to manage observable instances. |
|
Probably for now user could just create separate components for each animation and scope the observable in his HOC creator function. |
|
I think for most users function values should be enough. |
|
Totally, but then we have this Observables feature and it would be evtl nice to be able to use it with react-jss together. I don't know how to decide on whether it should be supported or not, I think if its not hard and does't causes additional bugs, we could. That thing per component can be solved in user space ... I guess your concern comes from implicitness of this behaviour one wouldn't expect? |
|
Yeah, exactly. |
|
On the other side it would be confusing not having support for observables in react-jss because it claims to support the same syntax, and Observables are part of it. |

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

Expected behavior:
Observable rules should not be included in the getDynamicStyles()
Describe the bug:
Observable rules are included in the results of getDynamicStyles()
Codesandbox link:
https://codesandbox.io/s/xrmo482nr4
Versions (please complete the following information):
Feel free to add any additional versions which you may think are relevant to the bug.