-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
alternative attachments syntax #15076
base: attachments
Are you sure you want to change the base?
Conversation
|
|
There seems to be a performance issue the first time attachments are used. The following are REPL's that do the same thing: It fixes the position of the caret when function binding is used to format an input's value. REPL using extra bindable prop The UI gets stuck temporarily when you start typing using the attachments variant. |
This comment was marked as outdated.
This comment was marked as outdated.
it should be |
Apologies for the mistake. I did not save the REPL because it is linked to a StackOverflow answer that references PR 15.000. |
would this work? The pr currently only supports explicit inline "declaration", e.g. let arr = [
(node) => console.log('a'),
(node) => console.log('b'),
(node) => console.log('c')
];
<input attach(arr)> or <input attach(...arr)> or <input attach((node) => {}, ...arr)> |
I don't know if this is overly important, but should attachments be expected to be added in a sequentially deterministic order? This isn't what I expected would happen for this example, but I'm also not certain whether it will matter for any practical use cases 🤷♂️ |
Gonna advocate for |
Indeed I find a bit worrying that the very special nature of actions isn't acknowledged with this syntax. An action can basically negates an arbitrary amount of Svelte code, without Svelte being notified at all. This should be among the very first things a developer reading a component should be aware of. Now this makes it very hard to scan and/or color highlight. Stepping outside Svelte realm should come with a warning. This attribute-like syntax heavily normalizes actions, making them a detail of your component, and telling the developer Have all the fun you want with your node!, which probably isn't the best idea. |
I think they should. I noticed that @Rich-Harris Incidentally, I really like just having one For destructuring, not sure if it's worth it, and not a big deal but wonder if pojos can also be destructured like arrays inside
@gterras I think this actually makes svelte more fun to use especially with transitions, animations, etc. as you're not scared away by some special more complicated syntax and instead you can just focus on functionality and js. |
Adding a |
I think I'm not sure I'm following your point on maintenance, especially if there is one one |
I stopped following the other PR because it got a bit too long, so I'm not sure what changes were made. Are attachments still spreadable with this alternative approach? Something like this I mean: Example |
You have to use I asked about object destructuring earlier #15076 (comment) |
alternative syntax for #15000: