Replies: 3 comments
-
use:behaviour |
Beta Was this translation helpful? Give feedback.
-
Renaming features is almost always a bad idea. As confusing as it is to have two different things called 'actions', it's generally clear from the context which is being referred to. If we change the name, this doesn't immediately update all references to 'actions' in every Svelte tutorial everyone's ever put online. The documentation would have to indefinitely have a note in it that says 'these used to be called actions, and you will see a lot of tutorials out there using that name'. Furthermore, there's a plan to, at some point in 5.x, introduce a feature that will be much nicer to use than actions while being more flexible. The details are not ironed out, and it was put on hold to focus on getting 5.0 out the door, but I expect that at some point actions are going to be deprecated and then, later still, removed. Renaming them when this is on the horizon would make everything much worse. |
Beta Was this translation helpful? Give feedback.
-
Echoing @Conduitry: this isn't gonna happen. I'm going to close this discussion so that people don't waste any time on this. Sorry. |
Beta Was this translation helpful? Give feedback.
-
Since the release of SvelteKit, there has been some overloading of the term "action" when developing Svelte apps.
In SvelteKit, there are form actions: https://kit.svelte.dev/docs/form-actions.
And in Svelte we have actions (https://svelte.dev/docs/svelte-action) to hook into the lifecycle of DOM elements and allow interop with third party libraries, etc.
Because a Svelte action is used to enhance form actions in SvelteKit, this can get confusing for newcomers. There's a great comment about this in the SvelteKit docs:
We could endlessly bikeshed possible alternative names. Some of these were brought up in the original pull request: #1247 (behaviours, traits, augmentations, enhancements, etc.).
Personally, I would rename
actions
toelement augments
, or justaugments
. I think this name better fits what these functions are doing, as they add functionality to DOM elements. We can keep the use directive:<div use:tooltip />
(ie: this div uses the tooltip augment).Would it be worth renaming them in Svelte 5? Seems like a good time to clean this up when other breaking changes are happening.
9 votes ·
Beta Was this translation helpful? Give feedback.
All reactions