svelte
svelte copied to clipboard
Svelte 5: default `intro` to `true` when using `mount`
Describe the problem
Presently, we disable intro transitions when mounting components. The reason we do this is to avoid flashes when hydrating (we don't want to 'fade in' an element that's already visible), but that only really applies to hydrate
.
Describe the proposed solution
Default intro
to true
when calling mount
, and false
when calling hydrate
. Continue to respect the option if it is set explicitly (which only really applies to mount
; it would be very unusual to enable intros when hydrating).
This would be a breaking change.
Importance
nice to have
Has there been widespread confusion about the existing behavior? Couldn't this have been done this way in Svelte 3, too (due to the hydrate constructor option)? Trying to estimate what the majority wants here and if this switch of defaults is warranted.
I don't know about widespread confusion — it's fairly well signposted in the docs. We absolutely could have done it in Svelte 3, we just overlooked it, and a new major is the right time to rectify a bad decision. It feels like an absolute no-brainer to me — as a component author you've already made your intent explicit by adding the transition:
directive in the first place. I guess we could run a poll but we should be wary of creating poll fatigue by running them for every small decision
Note: we should keep the existing behaviour when using createClassComponent
and asClassComponent