Is there any way to prevent compose web from overw...
# compose-web
b
Is there any way to prevent compose web from overwriting classes added externally? E.g. Ionic framework automatically adds classes like "hydrated" to certain elements. But Compose web erases them when re-composing
b
You might be able to merge them via DomSideEffect which gives you access to native element
a
It’s not allowed to mutate outside dom attributes which are controlled by compose, because there could be such conflicts.
b
I meant controlling all classes via DomSideEffect with proper keys. That way compose is oblivious of any classes
b
I understand why it was built that way, but in the real world, many existing JS libraries like to mess with classes & attributes. It's technically possible for Compose Web to be less destructive (e.g. don't remove a class that Compose itself didn't add) which would increase compatibility with existing libraries.
My workaround is that I've removed any state observation from the attr-builder lambda, so that it essentially never re-runs (so it never erases the externally-added classes). Still has me nervous about it though.