reagent

itaied 2024-04-18T07:45:34.019309Z

how do reagent handles order of keys for style when cljs map with over 8 keys doesn't preserve order? I'm facing an issue (using react directly) with a style map with more than 8 keys, where 2 keys order is important

juhoteperi 2024-04-18T08:06:56.680609Z

It doesn't. Probably the map value is used as is for doseq or such so you could be able to build a array-map yourself if you really need. What properties care about the order?

juhoteperi 2024-04-18T08:08:40.967509Z

Or if it doesn't work with React directly, it could be React itself will not care about style property order and it wouldn't help at all if Reagent keeps the order from Cljs array-map -> JS object

itaied 2024-04-18T08:21:22.917679Z

i had an issue with background-clip coming before background

itaied 2024-04-18T08:21:34.279199Z

ended up changing background to background-image

Roman Liutikov 2024-04-18T09:54:02.467979Z

this sounds interesting, style props order should not matter within the same block of styles

john 2024-04-18T11:16:39.073339Z

Do JavaScript object/maps preserve insertion order?

itaied 2024-04-18T11:19:17.127719Z

not guaranteed, but 99% of the use cases they do

juhoteperi 2024-04-18T13:48:14.099239Z

If I recall Reagent convert-props code, it should also use JS values as-is, so you could write :style #js {...} and it should use the value for the React element without conversion. But probably better idea in these cases to use the more specific CSS properties, instead shorthand properties and then specific properties to override something from the shorthand.

juhoteperi 2024-04-18T13:50:06.086229Z

Not sure how clear even the CSS spec is about order the properties are read in