Jarzka / stylefy

Clojure(Script) library for styling user interface components with ease.
MIT License
317 stars 10 forks source link

visibilty:hidden? #50

Open paintparty opened 3 years ago

paintparty commented 3 years ago

This is not a major issue, maybe not even an issue, just more of a question. It is something I've seen just a few times over a few months of heavy Stylefy use (have really enjoyed using the lib btw, thx!).

Every once in a blue moon in my dev environment ... When I change or create a style map that I'm passing to use-style, my style map is applied as a normal inline style (in the rendered element) and also visibility:hidden seems arbitrarily applied to the inline style as well (even when it is not in my style map).

This just now happened to me in a nested ui namespace. I then opened my project's core namespace, the same one from which I'm requiring stylefy and also stylefy-cache, and also calling stylefy-cache/clear. I re-saved it with no changes it the problem was resolved. I know this isn't exactly a detailed reproducible example but I'm not sure how to reproduce it!

Just wondering if you have come across this before? Specifically the style map being unexpectedly applied as an inline style and visibility:hidden making a guest appearance.

Jarzka commented 3 years ago

Glad to hear you like stylefy.

use-style sometimes returns inline style with visibility set to hidden to hide the component for a short period of time until all the CSS generation is done and the DOM is ready. After that, the component should show normally (if not, the library is not setup correctly or you are not using Reagent).

The reason for this behavior is to keep the library fast by doing as little amount of DOM updates as possible. A more detailed answer can be found in the README file (FAQ: How does the CSS generation work on the frontend?).