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
Each time <svelte:component> access the component attributes, internally it invokes a new component() instance.
If component() is heavy, it results in a slowdown of the whole page render.
This solves my problem, but I think it is worth investigating more, because I discovered it only by placing some console.log() inside my function: it could lead to very strange / unexpected behaviors.
You can avoid the reinvocation by using a @const tag:
Describe the bug
Look at the following code:
Each time
<svelte:component>
access thecomponent
attributes, internally it invokes a newcomponent()
instance.If
component()
is heavy, it results in a slowdown of the whole page render.This is the code generated by Svelte compiler:
Since I am already passing a valid Svelte component as parameter, I'd expect no new instance to be created.
Reproduction
I have created a small REPL here
This example renders 3 components, but console log shows them instantiated 6 times in total.
Logs
No response
System Info
Severity
blocking an upgrade
The text was updated successfully, but these errors were encountered: