You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The push and pop stuff is required to maintain the context stack for various reasons, and init is required if lifecycle functions (afterUpdate, beforeUpdate, onMount) are used.
Describe the proposed solution
A lot of the stuff on the component context object pertains to non-runes mode, and we could simplify it in runes mode. But we could also get rid of it altogether in a lot of cases. E.g. in runes mode, I'm pretty sure we can get rid of it if there are no exports and we can guarantee that we're not (indirectly) calling setContext. (The context object includes space for effects, but it's actually fine if they get attached to the parent context.)
This basically means that if a component contains a call/member expression that we can't guarantee is 'safe', we add the push/pop, but if not then we leave it out. Ideally the output above would look like this (note that the $$props parameter has also been removed):
* feat: only inject push/init/pop when necessary - closes#11297
* regenerate
* differentiate between safe/unsafe
* only inject $$props when necessary
* more
* fix
* simplify
* handle store subscriptions
Describe the problem
The Svelte 5
<h1>hello world</h1>
component looks like this:The
push
andpop
stuff is required to maintain the context stack for various reasons, andinit
is required if lifecycle functions (afterUpdate
,beforeUpdate
,onMount
) are used.Describe the proposed solution
A lot of the stuff on the component context object pertains to non-runes mode, and we could simplify it in runes mode. But we could also get rid of it altogether in a lot of cases. E.g. in runes mode, I'm pretty sure we can get rid of it if there are no exports and we can guarantee that we're not (indirectly) calling
setContext
. (The context object includes space for effects, but it's actually fine if they get attached to the parent context.)This basically means that if a component contains a call/member expression that we can't guarantee is 'safe', we add the push/pop, but if not then we leave it out. Ideally the output above would look like this (note that the
$$props
parameter has also been removed):Importance
nice to have
The text was updated successfully, but these errors were encountered: