dom-expressions icon indicating copy to clipboard operation
dom-expressions copied to clipboard

Consider whether we should combine spreads with other grouped expressions to preserve order

Open ryansolid opened this issue 3 years ago • 1 comments

Right now it looks like spreads go in first which is a bit awkward. Reactivity will cause last thing to win anyways and if it's dynamic versus static, well dynamic wins regardless of attribute order but can we do better with dynamic things. I kept spreads out because of awkwardness of diffing but I think we've made improvements here lately so that they could be inserted in order.

ryansolid avatar Dec 03 '21 23:12 ryansolid

Wanted to follow-up and add an issue I’ve been experiencing where using array syntax such as <Button onClick={[setSignal, (curr: boolean) => !curr]}> prevents <Button>’s internal onClick handler from being invoked.

Here is a repro that demonstrates my use case: https://playground.solidjs.com/?hash=-1717039610&version=1.4.1. And this is the Discord channel where I originally brought this up that includes some of your notes: https://discord.com/channels/722131463138705510/1013776165695131658.

@ryansolid: Basically there are 2 things going on. The spread + non-spread content isn't getting merged and it should.. there is an open issue on DOM Expressions for that. @ryansolid: The other issue I think is just that array is passed through and to forward through it takes some wiring which could be aided by a helper.

I’m not sure which one was relevant to this issue specifically so I wanted to include both your notes for future reference.

As a Solid user, I expected I would be able to use onClick={e => ...} and onClick={[...]} syntax interchangeably but this issue appears to be blocking that use case. I recommend warning users to only use onClick={[...]} syntax for native DOM elements as components can prevent events from firing when using array syntax.

zaydek avatar Sep 01 '22 15:09 zaydek

This should be fixed in 0.35.0

ryansolid avatar Oct 20 '22 05:10 ryansolid