{"action":"closed","issue":{"url":"https://api.github.com/repos/sveltejs/svelte.technology/issues/103","repository_url":"https://api.github.com/repos/sveltejs/svelte.technology","labels_url":"https://api.github.com/repos/sveltejs/svelte.technology/issues/103/labels{/name}","comments_url":"https://api.github.com/repos/sveltejs/svelte.technology/issues/103/comments","events_url":"https://api.github.com/repos/sveltejs/svelte.technology/issues/103/events","html_url":"https://github.com/sveltejs/svelte.technology/issues/103","id":235308018,"number":103,"title":"Prevent auto-instantiation of components with `oncreate`","user":{"login":"Rich-Harris","id":1162160,"avatar_url":"https://avatars3.githubusercontent.com/u/1162160?v=4","gravatar_id":"","url":"https://api.github.com/users/Rich-Harris","html_url":"https://github.com/Rich-Harris","followers_url":"https://api.github.com/users/Rich-Harris/followers","following_url":"https://api.github.com/users/Rich-Harris/following{/other_user}","gists_url":"https://api.github.com/users/Rich-Harris/gists{/gist_id}","starred_url":"https://api.github.com/users/Rich-Harris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Rich-Harris/subscriptions","organizations_url":"https://api.github.com/users/Rich-Harris/orgs","repos_url":"https://api.github.com/users/Rich-Harris/repos","events_url":"https://api.github.com/users/Rich-Harris/events{/privacy}","received_events_url":"https://api.github.com/users/Rich-Harris/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2017-06-12T17:40:52Z","updated_at":"2018-04-01T19:54:24Z","closed_at":"2018-04-01T19:54:24Z","author_association":"OWNER","body":"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).\r\n\r\nOne way we could prevent that is by waiting for user input before instantiating components — e.g. expecting a Cmd-Enter or a button click.\r\n\r\nThe same is true for e.g. [media elements](https://svelte.technology/repl?version=1.22.2&example=binding-media-elements).\r\n\r\nEasiest 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`."}}
{"actor":{"display_login":"Rich-Harris"}}