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
Because components are currently recompiled and reinstantiated on each keystroke, work that happens in an oncreate handler happens over and over again, which can be a little annoying in some cases (e.g. if you're doing a fetch, and it keeps making requests for non-existent resources because you're in the middle of typing the URL).
One way we could prevent that is by waiting for user input before instantiating components — e.g. expecting a Cmd-Enter or a button click.
Easiest thing to do is probably to have an option that lets you choose between as-you-type and on-command instantiation. One step beyond that would be to automatically choose between the two based on whether there's an oncreate or a media element (or any other similar conditions?). That would require that we have access to the component's AST, which would presumably mean updating svelte.compile to return a {code, map, ast} object instead of just code and map.
The text was updated successfully, but these errors were encountered:
Because components are currently recompiled and reinstantiated on each keystroke, work that happens in an
oncreate
handler happens over and over again, which can be a little annoying in some cases (e.g. if you're doing afetch
, and it keeps making requests for non-existent resources because you're in the middle of typing the URL).One way we could prevent that is by waiting for user input before instantiating components — e.g. expecting a Cmd-Enter or a button click.
The same is true for e.g. media elements.
Easiest thing to do is probably to have an option that lets you choose between as-you-type and on-command instantiation. One step beyond that would be to automatically choose between the two based on whether there's an
oncreate
or a media element (or any other similar conditions?). That would require that we have access to the component's AST, which would presumably mean updatingsvelte.compile
to return a{code, map, ast}
object instead of justcode
andmap
.The text was updated successfully, but these errors were encountered: