status
stringclasses
1 value
repo_name
stringlengths
9
24
repo_url
stringlengths
28
43
issue_id
int64
1
104k
updated_files
stringlengths
8
1.76k
title
stringlengths
4
369
body
stringlengths
0
254k
issue_url
stringlengths
37
56
pull_url
stringlengths
37
54
before_fix_sha
stringlengths
40
40
after_fix_sha
stringlengths
40
40
report_datetime
timestamp[ns, tz=UTC]
language
stringclasses
5 values
commit_datetime
timestamp[us, tz=UTC]
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
2,181
["CHANGELOG.md", "src/runtime/internal/utils.ts", "test/runtime/samples/store-auto-subscribe-nullish/_config.js", "test/runtime/samples/store-auto-subscribe-nullish/main.svelte"]
"Cannot read property 'subscribe' of undefined" when store creation is delayed
If you don't assign a store to a variable directly on initialisation you get the error `"Cannot read property 'subscribe' of undefined"` in `[email protected]`. This is a bit of a contrived example, but demonstrates the problem ([REPL](https://v3.svelte.technology/repl?version=3.0.0-beta.11&gist=ae979c1511a97f1b7138c6b33da4ae86)): ```html <!-- Foo.svelte --> <script> import { writable } from 'svelte/store' export let prop = null // Assigning a store to this variable further down gives rise to error // "Cannot read property 'subscribe' of undefined" let label; // This works // let label = prop === null ? writable('Foo') : writable(prop) if (prop === null) { label = writable('Foo') } else { label = writable(prop) } </script> <div>{$label}</div> ``` [This worked back in `beta.3`](https://v3.svelte.technology/repl?version=3.0.0-beta.3&gist=ae979c1511a97f1b7138c6b33da4ae86).
https://github.com/sveltejs/svelte/issues/2181
https://github.com/sveltejs/svelte/pull/4304
fd9b23e5e469399ef30a34dec9c070bc8eaf42a9
f01bb639be2c832a6813edcd931b1fb886d3b01a
2019-03-08T16:11:55Z
javascript
2020-01-23T15:40:22Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
2,180
["src/compile/render-dom/wrappers/EachBlock.ts", "test/js/samples/each-block-array-literal/expected.js", "test/js/samples/each-block-array-literal/input.svelte"]
Optimise each blocks with array literals
Small thing, but it would be neat to optimise each blocks with array literals, as in [this example](https://v3.svelte.technology/repl?version=3.0.0-beta.11&demo=svg-clock): ```html {#each [1, 2, 3, 4] as offset} <line class='minor' y1='42' y2='45' transform='rotate({6 * (minute + offset)})' /> {/each} ``` ```diff function create_each_block(ctx) { var line, each_anchor; var each_value_1 = [1, 2, 3, 4]; var each_blocks = []; - for (var i = 0; i < each_value_1.length; i += 1) { + for (var i = 0; i < 4; i += 1) { each_blocks[i] = create_each_block_1(get_each_context_1(ctx, each_value_1, i)); } return { c() { line = createSvgElement("line"); - for (var i = 0; i < each_blocks.length; i += 1) { + for (var i = 0; i < 4; i += 1) { each_blocks[i].c(); } each_anchor = createComment(); setAttribute(line, "class", "major svelte-tbg81i"); setAttribute(line, "y1", "35"); setAttribute(line, "y2", "45"); setAttribute(line, "transform", "rotate(" + 30 * ctx.minute + ")"); }, m(target, anchor) { insert(target, line, anchor); - for (var i = 0; i < each_blocks.length; i += 1) { + for (var i = 0; i < 4; i += 1) { each_blocks[i].m(target, anchor); } insert(target, each_anchor, anchor); }, p: noop, d(detach) { if (detach) { detachNode(line); } destroyEach(each_blocks, detach); if (detach) { detachNode(each_anchor); } } }; } ``` Could also do the same when it's declared in the script block and we know it never gets mutated or reassigned (though need to watch out for `push(...)` and friends), as in https://v3.svelte.technology/tutorial/svelte-window-bindings.
https://github.com/sveltejs/svelte/issues/2180
https://github.com/sveltejs/svelte/pull/2188
06040d3513b326570b2c279ac54b7146708f8c53
b604b5223c912edfff1c25dfba334115c0859753
2019-03-08T13:44:21Z
javascript
2019-03-09T21:58:42Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
2,178
["src/compile/Component.ts", "test/runtime/samples/reactive-values-self-dependency-b/_config.js", "test/runtime/samples/reactive-values-self-dependency-b/main.svelte"]
Unexpected token at Reactivity Statements tutorial
Open [Reactivity Statements tutorial](https://v3.svelte.technology/tutorial/reactive-statements) Click button **SHOW ME** Error `Unexpected token (Note that you need plugins to import files that are not JavaScript)` **This happens too on local development:** `rollup v1.5.0` `bundles src/main.js → public/bundle.js...` `(!) Error when using sourcemap for reporting an error: Can't resolve original location of error. src/App.svelte: (106:6)` `[!] Error: Unexpected token (Note that you need plugins to import files that are not JavaScript) src/App.svelte (106:6)` `Error: Unexpected token (Note that you need plugins to import files that are not JavaScript)` `at error (/home/i/localhost/svelte/v3/tutorial/node_modules/rollup/dist/rollup.js:3601:30)` `at Module.error (/home/i/localhost/svelte/v3/tutorial/node_modules/rollup/dist/rollup.js:14470:9)` `at tryParse (/home/i/localhost/svelte/v3/tutorial/node_modules/rollup/dist/rollup.js:14390:16)` `at Module.setSource (/home/i/localhost/svelte/v3/tutorial/node_modules/rollup/dist/rollup.js:14664:35)` `at /home/i/localhost/svelte/v3/tutorial/node_modules/rollup/dist/rollup.js:17827:20`
https://github.com/sveltejs/svelte/issues/2178
https://github.com/sveltejs/svelte/pull/2191
f2a48145a86f91f7e3ad9314e5368d0d2d964ee1
d479d8a4306623b26f6ca7be2310892431b729d7
2019-03-08T08:46:52Z
javascript
2019-03-10T02:55:07Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
2,176
["src/compile/Component.ts", "test/validator/samples/module-script-reactive-declaration/input.svelte", "test/validator/samples/module-script-reactive-declaration/warnings.json", "test/validator/samples/reactive-declaration-non-top-level/input.svelte", "test/validator/samples/reactive-declaration-non-top-level/warnings.json"]
Compiler warnings for non-top-level reactive declarations
If you use the `$:` reactive declaration syntax anywhere but at the top level, the compiler currently treats it like a regular label and goes merrily along its way. This should at least be a warning, possibly an error.
https://github.com/sveltejs/svelte/issues/2176
https://github.com/sveltejs/svelte/pull/2679
43f82af4a8172efa9a4735d6fd9c8fd41e9943c5
4bc93a3b1fbbd9c96f209cff6456f8c685c3ece0
2019-03-08T04:04:05Z
javascript
2019-05-06T10:52:17Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
2,175
["src/compile/Component.ts", "src/compile/render-dom/wrappers/InlineComponent/index.ts", "src/compile/render-ssr/handlers/InlineComponent.ts", "test/runtime/samples/component-name-deconflicted-globals/Countdown.svelte", "test/runtime/samples/component-name-deconflicted-globals/_config.js", "test/runtime/samples/component-name-deconflicted-globals/main.svelte"]
Component name isn't deconflicted against assumed globals
Contrary to what https://v3.svelte.technology/tutorial/self says, you *can* use `<Folder>` instead of `<svelte:self>`. That's a bug.
https://github.com/sveltejs/svelte/issues/2175
https://github.com/sveltejs/svelte/pull/2189
b604b5223c912edfff1c25dfba334115c0859753
24c36e8cb21d6eb5fc8652380e7c8c8b96556a66
2019-03-08T01:36:15Z
javascript
2019-03-09T21:59:09Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
2,173
["src/compile/Component.ts", "test/js/samples/reactive-values-non-writable-dependencies/expected.js", "test/validator/samples/reactive-declaration-no-deps/errors.json", "test/validator/samples/reactive-declaration-no-deps/input.svelte"]
Dependency-less reactive declarations generate invalid code
Compiling ```html <script> $: console.log('foo'); </script> ``` generates code containing ```javascript if () { console.log('foo'); } ``` instead of throwing at compile time, which is what I think used to happen.
https://github.com/sveltejs/svelte/issues/2173
https://github.com/sveltejs/svelte/pull/2228
9d0150392304701cfce3e7679f8f5c710986e2de
1fe76d45a62b3ded6eb0b7a644a750cb66717773
2019-03-07T15:37:52Z
javascript
2019-03-15T23:37:20Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
2,171
["src/compile/render-dom/wrappers/Element/Binding.ts", "store.mjs", "test/runtime/samples/binding-store-deep/_config.js", "test/store/index.js"]
store.update(n => mutate(n))
Something came up in Discord that I've also wondered about once or twice: ```js const store = writable({ x: 1 }); store.subscribe(value => { console.log(value.x); }); // logs 1 store.update(obj => ({ obj.x += 1; return obj; }); // does nothing ``` Setting a store to the same object, albeit mutated, does nothing. This was intentional (to encourage use of immutable data structures), but it can be a little annoying. Part of me wonders if stores should call their subscribers if `set` or `update` is called with the same value (as long as it's a non-primitive) — i.e. the same semantics as assignments elsewhere in Svelte. After all, if you call `set` or `update` it's probably because something did in fact change. This would also enable deep bindings (`<input bind:value={$foo.bar.baz}>`) to work. Currently, they don't.
https://github.com/sveltejs/svelte/issues/2171
https://github.com/sveltejs/svelte/pull/2190
24c36e8cb21d6eb5fc8652380e7c8c8b96556a66
8875fa892e5d6bfefd9f261ca97c90b37985f86c
2019-03-07T05:08:49Z
javascript
2019-03-09T22:02:39Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
2,170
["src/compile/Component.ts", "test/runtime/samples/store-assignment-updates/_config.js", "test/runtime/samples/store-assignment-updates/main.svelte"]
Allow store updates by assigning to `$store` or have compiler error/warning
I don't know whether we're ready to decide that we want to turn `$store = foo` or `$store += foo` into calls to `store.set()` or `store.update()`, but in the meantime we should definitely make those be a compiler warning or probably an error.
https://github.com/sveltejs/svelte/issues/2170
https://github.com/sveltejs/svelte/pull/2250
e87976dc21575afa4742ec5fb79365860e76092e
1e3666f86f1574bf3def56cd462b210407ab6012
2019-03-06T23:27:16Z
javascript
2019-03-17T23:24:08Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
2,166
["site/src/components/Repl/CodeMirror.svelte", "site/src/components/Repl/Input/ComponentSelector.svelte", "site/src/components/Repl/Input/ModuleEditor.svelte", "site/src/components/Repl/Output/index.svelte", "site/src/components/Repl/index.svelte", "site/src/routes/tutorial/[slug]/_components/TableOfContents.svelte"]
Clicking between components restarts REPL
it shouldn't
https://github.com/sveltejs/svelte/issues/2166
https://github.com/sveltejs/svelte/pull/2196
00df135283f2a7dcebdfeb9a055714f9f14317f8
dd6a962f3ea2acca83080181ef07fc540076e91c
2019-03-06T13:57:56Z
javascript
2019-03-10T15:09:32Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
2,165
["src/compile/Component.ts", "test/runtime/samples/mixed-let-export/_config.js", "test/runtime/samples/mixed-let-export/main.svelte"]
Svelte v3 code generation bug
Error occured in this [REPL example](https://v3.svelte.technology/repl?version=3.0.0-beta.10&gist=3b921465e93f1da097fb21f3c68c0f1b) Seems, error won't occurred if I'll not combine exported and non-exported values in a `let` declaration: ```javascript let foo, bar; let baz; export { foo, bar }; ``` This definitely very unexpected.
https://github.com/sveltejs/svelte/issues/2165
https://github.com/sveltejs/svelte/pull/2172
c019150112d1a494773f0dd5ff9f21d0048f74c3
4090925a8e80f32f332e5ca31308a17a5e7175aa
2019-03-06T12:07:22Z
javascript
2019-03-07T13:38:39Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
2,159
["src/internal/transitions.js", "test/runtime/samples/transition-js-deferred-b/_config.js", "test/runtime/samples/transition-js-deferred-b/main.svelte", "test/runtime/samples/transition-js-deferred/_config.js", "test/runtime/samples/transition-js-deferred/main.svelte"]
deferred transitions aren't working
[REPL](https://v3.svelte.technology/repl?version=3.0.0-beta.10&gist=be335419a71970bb2360a12cafbc0fe9). The functions returned from `send` and `receive` are running immediately, meaning they can't talk to each other. Side-note: `crossfade` should be in `svelte/transition`.
https://github.com/sveltejs/svelte/issues/2159
https://github.com/sveltejs/svelte/pull/2240
474bde15e056ef96b56b23946bb457b82a7c4f4f
22e09c46e359f44528bff91397758aeacd62b2c2
2019-03-04T04:45:45Z
javascript
2019-03-16T22:21:24Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
2,158
["src/internal/transitions.js", "test/runtime/samples/transition-js-events/_config.js", "test/runtime/samples/transition-js-events/main.svelte"]
`outrostart` event doesn't appear to fire
[REPL](https://v3.svelte.technology/repl?version=3.0.0-beta.10&gist=7645c79c0ee082a32de03e335d0ce316). Its `introstart`, `introend` and `outroend` counterparts all work fine.
https://github.com/sveltejs/svelte/issues/2158
https://github.com/sveltejs/svelte/pull/2239
dd235a02e18e2c92ce36ee6487bd5b9f4f6309cf
474bde15e056ef96b56b23946bb457b82a7c4f4f
2019-03-04T04:22:47Z
javascript
2019-03-16T21:44:28Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
2,154
["src/parse/state/mustache.ts", "test/parser/samples/raw-mustaches-whitespace-error/error.json", "test/parser/samples/raw-mustaches-whitespace-error/input.svelte"]
Parser doesn't insist on whitespace after @html
[REPL](https://v3.svelte.technology/repl?version=3.0.0-beta.10&gist=240ec320582206305808ddbc18d26bdb). This seems bad ```html <script> let string = `this string contains some <strong>HTML!!!</strong>`; </script> <p>{@htmlstring}</p> ```
https://github.com/sveltejs/svelte/issues/2154
https://github.com/sveltejs/svelte/pull/2168
7373db4ffbaec6743894ff4ae5f71dccaeb2c717
713eb158ad60d9c4fb7d729034da72162337d8fa
2019-03-03T19:13:33Z
javascript
2019-03-07T13:33:28Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
2,149
["src/compile/nodes/EventHandler.ts", "test/runtime/samples/event-handler-destructured/_config.js", "test/runtime/samples/event-handler-destructured/main.svelte"]
Can't use destructured variable declaration for event handler
[REPL](https://v3.svelte.technology/repl?version=3.0.0-beta.9&gist=45aaa8708abb38be40448679270a2122). `const handler` works, but `const { handler }` doesn't, because of a bug in some AST traversal somewhere
https://github.com/sveltejs/svelte/issues/2149
https://github.com/sveltejs/svelte/pull/2150
03f74c1505b851cb94bc69c6bf5ca176d95e5c9d
ac38a286e62527900d11d2c5ec041740c9d4a648
2019-03-02T17:23:01Z
javascript
2019-03-02T18:58:34Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
2,147
["src/compiler/compile/render_dom/wrappers/Element/index.ts", "src/runtime/internal/dom.ts", "test/js/samples/bind-width-height/expected.js", "test/js/samples/video-bindings/expected.js", "test/runtime/samples/binding-width-height-a11y/_config.js"]
bind:clientWidth doesn't work in sandbox
[REPL](https://v3.svelte.technology/repl?version=3.0.0-beta.9&gist=648026c694e2323428e82b60c38829d0). Resizing the viewer window doesn't change anything.
https://github.com/sveltejs/svelte/issues/2147
https://github.com/sveltejs/svelte/pull/2989
cc3c7fa9f4ab4ce627daf21945d3ec0c2b2c3b63
ff5f25249e39985b6ca88c6815d123f26e40402a
2019-03-02T03:59:58Z
javascript
2020-04-20T13:05:37Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
2,146
["src/compile/render-dom/wrappers/Element/index.ts", "test/runtime/samples/binding-input-checkbox-deep-contextual-b/_config.js", "test/runtime/samples/binding-input-checkbox-deep-contextual-b/main.svelte"]
Checkbox binding bug
[REPL](https://v3.svelte.technology/repl?version=3.0.0-beta.9&gist=1843f6834f0f4b2b52dae11647ff1a37)
https://github.com/sveltejs/svelte/issues/2146
https://github.com/sveltejs/svelte/pull/2231
becb6d4a931780a5b0accae67d4e01704a2aa1e2
d618c238f55283e5033e2327b44718ba3fe087b3
2019-03-01T23:50:59Z
javascript
2019-03-16T15:45:55Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
2,139
["src/compile/Component.ts", "test/runtime/samples/store-auto-subscribe-missing-global-script/_config.js", "test/runtime/samples/store-auto-subscribe-missing-global-script/main.svelte", "test/runtime/samples/store-auto-subscribe-missing-global-template/_config.js", "test/runtime/samples/store-auto-subscribe-missing-global-template/main.svelte"]
Cannot set property 'subscribable' of undefined
This happens when referencing a non existent store. The error does not contain any sign of where it is thrown which means it takes a lot of time to fix. One workaround is to open compiler.js:22884 and add `if (!variable) console.log('subscribable', name, this.file)`. Error is thrown here: https://github.com/sveltejs/svelte/blob/716e0df910fd7ca7eae9ae4f50691e962d6eee7d/src/compile/Component.ts#L193 Stack trace <details> <summary>Cannot set property 'subscribable' of undefined</summary> at Component.add_reference (/Users/thomas/projects/ga/node_modules/svelte/compiler.js:22884:40) at Object.enter (/Users/thomas/projects/ga/node_modules/svelte/compiler.js:21133:36) at visit (/Users/thomas/projects/ga/node_modules/svelte/compiler.js:10204:10) at walk (/Users/thomas/projects/ga/node_modules/svelte/compiler.js:10184:3) at new Expression (/Users/thomas/projects/ga/node_modules/svelte/compiler.js:21094:10) at new EachBlock$1 (/Users/thomas/projects/ga/node_modules/svelte/compiler.js:21547:28) at children.map.child (/Users/thomas/projects/ga/node_modules/svelte/compiler.js:22695:23) at Array.map (<anonymous>) at mapChildren (/Users/thomas/projects/ga/node_modules/svelte/compiler.js:22693:22) at new Element$1 (/Users/thomas/projects/ga/node_modules/svelte/compiler.js:21974:26) </details> Repro: https://v3.svelte.technology/repl?version=3.0.0-beta.8&gist=b154d4f0c5e6d1cc3a03a70a1b7d2350 Same error 2: ```html <h1>Hello</h1> <script> function test () { $name = 2 } </script> ``` Same error 3: ```html <h1>Hello</h1> <script> $name = 2 </script> ```
https://github.com/sveltejs/svelte/issues/2139
https://github.com/sveltejs/svelte/pull/2314
ef40a720a3f4115ca7de3189140a33bd66601abf
415da7dade1e007562f4d35a11230fe532f6b954
2019-02-27T14:15:45Z
javascript
2019-03-25T20:22:55Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
2,137
["src/parse/state/mustache.ts", "test/parser/samples/if-block-elseif/input.svelte", "test/parser/samples/if-block-elseif/output.json", "test/runtime/samples/dynamic-component-slot/main.svelte", "test/runtime/samples/if-block-elseif-no-else/main.svelte", "test/runtime/samples/if-block-elseif-text/main.svelte", "test/runtime/samples/if-block-elseif/main.svelte", "test/runtime/samples/if-block-outro-nested-else/main.svelte", "test/runtime/samples/transition-js-if-elseif-block-outro/main.svelte"]
{:elseif foo} or {:else if foo} ?
Writing the docs for v3, got to the section on `{:elseif ...}` and realised that I couldn't quite justify why it's that instead of `{:else if ...}`. Should we change it? If so, now would be the time to do it. Arguments for changing (sound off in the comments and I'll update the bullet point lists): * `else if` is JavaScriptier * Muscle memory * it... kinda looks nicer, I think? Arguments against: * `elseif` is arguably more consistent with other templating languages * If in doubt, the presumption should be in favour of not changing * you can double-click `elseif` to highlight the whole word, which @arxpoetica enjoys apparently? --- ```html <!-- current --> {#if x > 10} <p>{x} is greater than 10</p> {:elseif 5 > x} <p>{x} is less than 5</p> {:else} <p>{x} is between 5 and 10</p> {/if} ``` ```html <!-- alternative --> {#if x > 10} <p>{x} is greater than 10</p> {:else if 5 > x} <p>{x} is less than 5</p> {:else} <p>{x} is between 5 and 10</p> {/if} ```
https://github.com/sveltejs/svelte/issues/2137
https://github.com/sveltejs/svelte/pull/2138
33fa7347bfbb34f43bced5d4405e11708a5f1b48
f3486fd7260ea45285bbe583a42f24bad3033285
2019-02-27T02:54:47Z
javascript
2019-02-28T00:19:24Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
2,135
["src/runtime/internal/ssr.ts", "test/runtime/samples/binding-circular/_config.js", "test/runtime/samples/binding-circular/main.svelte"]
Can't serialize circular values
[REPL](https://v3.svelte.technology/repl?version=3.0.0-beta.8&gist=13acf77b99e2e9dda003b712f842e120). This (admittedly somewhat rare) case fails in SSR, because it tries to do `JSON.stringify(circular)`: ```html <script> let circular = {}; circular.self = circular; </script> <select bind:value={circular}> <option value={circular}>wheeee</option> </select> ``` ```js /* App.svelte generated by Svelte v3.0.0-beta.8 */ import { create_ssr_component, escape } from "svelte/internal"; const App = create_ssr_component(($$result, $$props, $$bindings, $$slots) => { let circular = {}; circular.self = circular; return `<select ${(v => v ? ("value" + (v === true ? "" : "=" + JSON.stringify(v))) : "")(circular)}> <option${(v => v == null ? "" : ` value="${escape(circular)}"`)(circular)}>wheeee</option> </select>`; }); export default App; ```
https://github.com/sveltejs/svelte/issues/2135
https://github.com/sveltejs/svelte/pull/3146
2915cf9cc33ab3325d4744d50e6ce7040b271c98
1427206f85c8ac4bb2f873f43ac289c75c8b86bc
2019-02-26T02:41:44Z
javascript
2019-07-01T15:27:32Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
2,133
["src/compile/nodes/Action.ts", "src/compile/nodes/Animation.ts", "src/compile/nodes/Transition.ts", "test/vars/index.js", "test/vars/samples/actions/_config.js", "test/vars/samples/actions/input.svelte", "test/vars/samples/animations/_config.js", "test/vars/samples/animations/input.svelte", "test/vars/samples/transitions/_config.js", "test/vars/samples/transitions/input.svelte"]
Certain directives don't cause `vars` to be `referenced` when compilation isn't with `generate: 'dom'`
At the very least, it looks like `referenced` is false for variables used as actions when `generate: false` is specified. (They look okay when a compiled component is being generated, though.) I'll have to go through and look for any other differences. It's probably also a good idea to extend the `vars` tests so as to run three times for each one (DOM, SSR, false).
https://github.com/sveltejs/svelte/issues/2133
https://github.com/sveltejs/svelte/pull/2136
c672ad8df7a2f3c9d763dccc6b13d8283d14ec1d
5bf3b0bb6a183d3e80b1c6dc3b9502ef7d5a1e4b
2019-02-25T15:05:15Z
javascript
2019-02-27T13:07:56Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
2,129
["src/compile/Component.ts", "test/js/samples/dev-warning-missing-data-computed/expected.js", "test/js/samples/reactive-values-non-topologically-ordered/expected.js", "test/js/samples/reactive-values-non-writable-dependencies/expected.js", "test/runtime/samples/reactive-values-overwrite/_config.js", "test/runtime/samples/reactive-values-overwrite/main.svelte", "test/runtime/samples/reactive-values-subscript-assignment/_config.js", "test/runtime/samples/reactive-values-subscript-assignment/main.svelte"]
Proposal: Don't re-trigger reactive declarations when their assignees are re-assigned
Lumpy title aside, this is basically proposing that if you have `$: foo = bar;` then assignments to `foo` shouldn't retrigger the reactive declaration to be run. The rationale for this was "it was trying to make `foo` read-only — like, if it's a prop, a consumer of that component shouldn't be able to set `foo` to a value other than `bar`" but I think that this causes more problems than it solves. Props don't sound to me to be the right place to have data live that's going to be flowing out of the component. If you do want to be able to assign to `foo` freely elsewhere in the component and not have it be re-set to `bar`, the current workaround is to do something like ```javascript function updateFoo(bar) { foo = bar; } $: updateFoo(bar); ``` which seems ugly and unnecessary. It's basically tricking the compiler out of making a bad decision. Other better ways to have read-only computed props include: component methods that return the value, read-only store properties on component instances, and events.
https://github.com/sveltejs/svelte/issues/2129
https://github.com/sveltejs/svelte/pull/2161
713eb158ad60d9c4fb7d729034da72162337d8fa
c019150112d1a494773f0dd5ff9f21d0048f74c3
2019-02-22T16:55:45Z
javascript
2019-03-07T13:34:44Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
2,127
["src/compile/Component.ts"]
Hairy code generation bug
If a variable is 1. exported, 2. sandwiched between other exported variables, 3. marked as subscribable, it [causes some funky code to get generated](https://v3.svelte.technology/repl?version=3.0.0-beta.8&gist=9e08a9527c9fe70db79681d9f0d46a78): ```html <script> export let a; export let b; export let c; </script> {$b} ``` ```js function instance($$self, $$props, $$invalidate) { let $b; let { a, { } = $$props; subscribe($$self, b, $$value => { $b = $$value; $$invalidate('$b', $b) })c } = $$props; $$self.$set = $$props => { if ('a' in $$props) $$invalidate('a', a = $$props.a); if ('b' in $$props) $$invalidate('b', b = $$props.b); if ('c' in $$props) $$invalidate('c', c = $$props.c); }; return { a, b, c, $b }; } ``` We're basically at the limits of what code transformations are possible with the magic-string approach. Starting to dream about more sophisticated techniques for AST traversal/code editing.
https://github.com/sveltejs/svelte/issues/2127
https://github.com/sveltejs/svelte/pull/2142
5459b71276deaa9d16458aca61b58631fcd6aa10
8c044d5572fb6744f5e74b3bbe1e55247a7802e4
2019-02-22T14:21:19Z
javascript
2019-02-28T05:24:41Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
2,122
["src/compile/render-dom/wrappers/Slot.ts"]
Static slot tries to be updated, throws error (v3)
<!-- Thanks for raising an issue! (For *questions*, we recommend instead using https://stackoverflow.com and adding the 'svelte' tag.) To help us help you, if you've found a bug please consider the following: * If you can demonstrate the bug using https://svelte.technology/repl, please do. * If that's not possible, we recommend creating a small repo that illustrates the problem. * Make sure you include information about the browser, and which version of Svelte you're using Reproductions should be small, self-contained, correct examples – http://sscce.org. Occasionally, this won't be possible, and that's fine – we still appreciate you raising the issue. But please understand that Svelte is run by unpaid volunteers in their free time, and issues that follow these instructions will get fixed faster. If you have a stack trace to include, we recommend putting inside a `<details>` block for the sake of the thread's readability: <details> <summary>Stack trace</summary> Stack trace goes here... </details> --> So I have this REPL here at https://v3.svelte.technology/repl?version=3.0.0-beta.7&gist=83b45ebdf71c94eac71319c182537559 ... `App.svelte` is just a `Modal` component with a text-only slot that never changes, and a slot that depends on some timers... ``` <Modal> <span slot="title">Processing...</span> <span slot="content"> <p>Pages done/total: {pagesDone} / {pagesTotal}</p> ``` As the timers update the `pagesDone` state, the application crashes with ``` TypeError: title_slot.p is not a function ``` Digging a bit in the generated JS, I can see that `title_slot` is created without a `p()` / `update()` method, but `content_slot` is, and updating the application's state calls both `title_slot.p()` and `content_slot.p()` i.e.: ``` /* Snips from generated code */ function create_title_slot(ctx) { return { c() { /* etc*/ }, m(target, anchor) { /* etc*/ }, d(detach) { /* etc*/ } }; } function create_content_slot(ctx) { return { c() { /* etc*/ }, m(target, anchor) { /* etc*/ }, p(changed, ctx) { /* etc */ }, d(detach) { /* etc*/ } }; } function create_fragment(ctx) { return { c() { /* etc*/ }, m(target, anchor) { /* etc*/ }, p(changed, ctx) { if (title_slot && changed.$$scope) { title_slot.p( /* etc */ ); } if (content_slot && changed.$$scope) { content_slot.p( /* etc */ ); } }, d(detach) { /* etc*/ } }; } ```
https://github.com/sveltejs/svelte/issues/2122
https://github.com/sveltejs/svelte/pull/2128
c494c05ebfb0006a3a010c051eed291ab7c806b6
295019f9e4956f7b870bfa7e2500b917e41328c5
2019-02-21T20:32:18Z
javascript
2019-02-22T16:46:25Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
2,119
["src/compile/Component.ts", "src/compile/render-dom/index.ts", "test/runtime/samples/store-assignment-updates-reactive/_config.js", "test/runtime/samples/store-assignment-updates-reactive/main.svelte", "test/runtime/samples/store-assignment-updates/_config.js"]
Topological ordering of reactive statements breaks with stores
[REPL](https://v3.svelte.technology/repl?version=3.0.0-beta.7&gist=92f5f25c230b5f70377a5703921fd2d6). ```html <script> import { writable } from 'svelte/store'; const a = writable(); const b = writable(); const c = writable(0); $: a.set($b); $: b.set($c); // this works: setTimeout(() => a.set($b)); // or you can manually reverse the order of the statements function increment() { c.update(n => n + 1); } </script> <p>a: {$a}</p> <p>b: {$b}</p> <p>c: {$c}</p> <button on:click={increment}>+1</button> ``` The first statement doesn't recognise that the second one will update the value of `$b`, by virtue of `b.set`. Not sure how best to approach this. On the one hand we *could* look for `store.set` and `store.update` calls and treat those as assignments, but that takes us into slightly magical territory. (It's similar to reactive statements that call functions that cause assignments to dependencies of other reactive statements, which also aren't handled.) Maybe it gets filed under 'user error'? Or maybe we issue warnings on a best-effort basis, telling people to reorder their statements? Relatedly, I wonder if we should allow `$a = $b` in components (would get converted to `a.set($b)`; something like `$count += 1` would get converted to `count.update(v => v + 1)`).
https://github.com/sveltejs/svelte/issues/2119
https://github.com/sveltejs/svelte/pull/2265
beeaa3d09bea4db5a5fd12962d15b591836d63bc
f6aed0810b18949e6232fbb93c02db22ce89cdc5
2019-02-21T16:28:36Z
javascript
2019-03-18T20:23:15Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
2,115
["src/compile/render-dom/wrappers/Element/Attribute.ts", "test/runtime/samples/contextual-callback-b/_config.js", "test/runtime/samples/contextual-callback-b/main.svelte"]
Cannot set property 'maintainContext' of undefined (v3)
Note: The REPL in firefox throws a `block is undefined` error. The chrome error is `Cannot set property 'maintainContext' of undefined` which is consistent with local behaviour (terminal error). I came across this bug when refactoring some (very) long components into multiple smaller ones, so the repro was difficult to come by. The actual problem is very straightforward though: svelte doesn't seem to like passing the `index` of an each loop (the parent loop) down into a callback function (as a prop to a child). If this is just me doing something awful, feel free to shame me publicly. The REPL is weird with broken code. This should work, just uncomment the reference to `<Child />` and it should work (break). The child isn't important, its the fact that the callback is using the index and being passed down. This doesn't happen when passing normal props. [REPL Link](https://v3.svelte.technology/repl?version=3.0.0-beta.5&gist=12fc2f64cbb5df6a06d76e8f0094ec34) ```html <!-- App.svelte --> <script> import Child from './Child.svelte'; let list = [1,2,3] function fn(i) { console.log(i); } </script> boo {#each list as o, i} <Child one={o} cb="{() => fn(i)}" /> {/each} ```
https://github.com/sveltejs/svelte/issues/2115
https://github.com/sveltejs/svelte/pull/2349
c20ad223637f6253a2ed6696fd4b94f681496628
c853e44130dfd6ec4623d8cd0019f9506d5b7b5d
2019-02-20T11:20:00Z
javascript
2019-04-06T12:40:26Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
2,112
["src/cli/compile.ts"]
CLI broken in latest betas
The breaking changes to the compiler API in the recent betas have also broken the CLI. I imagine we're going to have to update warning handling, but before that I'm also seeing a slightly unexpected error `Unrecognized option 'sourceMap'`.
https://github.com/sveltejs/svelte/issues/2112
https://github.com/sveltejs/svelte/pull/2113
2f0069a138590e7572f0d76da285fbbf3d763442
d6b2d362d2224bca82e4209278b45064b6b1986c
2019-02-20T02:38:50Z
javascript
2019-02-20T12:14:51Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
2,110
["src/compile/render-dom/wrappers/Element/index.ts", "src/compile/render-dom/wrappers/MustacheTag.ts", "test/runtime/samples/component-slot-named-b/Nested.svelte", "test/runtime/samples/component-slot-named-b/_config.js", "test/runtime/samples/component-slot-named-b/main.svelte"]
Named slot bug
A named slot that contains a variable has a bug in v3.0.0-beta.5 https://v3.svelte.technology/repl?version=3.0.0-beta.5&gist=89e16e7c3cc78b52369145fc8552ebf1 vs https://v3.svelte.technology/repl?version=3.0.0-beta.3&gist=89e16e7c3cc78b52369145fc8552ebf1
https://github.com/sveltejs/svelte/issues/2110
https://github.com/sveltejs/svelte/pull/2117
3409840eb69735065e28d1e4ec55e95915a1e963
18a98c0f62b7ce145700312c9ee72c76311c3b9c
2019-02-20T00:02:30Z
javascript
2019-02-20T14:15:44Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
2,098
["src/compile/render-dom/wrappers/Element/index.ts", "src/internal/animations.js", "test/js/samples/each-block-keyed-animated/expected.js", "test/runtime/samples/animation-js/_config.js"]
animate directives broken in recent alpha/beta (v3)
In a recent build (I will try to work out which build tomorrow evening but it isn't terribly recent, the REPL errors out if you go back too far: somewhere between alpha 12 and alpha20-something) animate directives have stopped working. Tests are passing for some animations (js one) but I can't get either to work either in the REPL or locally. The error is a 'too much recursion' or 'maximum call stack size exceeded' error. The most helpful I can be is that the error looks something like this in chrome: ``` VM48:4 Uncaught (in promise) RangeError: Maximum call stack size exceeded at noop (eval at handleMessage (repl-runner.js:46), <anonymous>:4:15) at animate$$1 (eval at handleMessage (repl-runner.js:46), <anonymous>:459:5) ... at animate$$1 (eval at handleMessage (repl-runner.js:46), <anonymous>:460:22) Promise.then (async)   schedule_update @ internal.mjs:883   make_dirty @ internal.mjs:1303   $$.ctx.instance @ internal.mjs:1345   flipIt @ App.svelte:27 ``` The REPL examples below are copied from the tests. They might be still passing because the first time they are shuffled, the elements do reposition, they just don't animate, and the error kills the app preventing any subsequent actions. This is just speculation. [REPL - JS Animations](https://v3.svelte.technology/repl?version=3.0.0-beta.3&gist=3e7c2a7e9bdceab88141f08b1517693b) [REPL - CSS Animations](https://v3.svelte.technology/repl?version=3.0.0-beta.3&gist=82a31523da5af825c6773aebcee543dd)
https://github.com/sveltejs/svelte/issues/2098
https://github.com/sveltejs/svelte/pull/2238
088bb7bcd0dfbba098ec6f246ab39acd7e806ee6
dd235a02e18e2c92ce36ee6487bd5b9f4f6309cf
2019-02-17T23:22:41Z
javascript
2019-03-16T21:43:16Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
2,086
["src/runtime/internal/dom.ts"]
Uncaught (in promise) TypeError: Cannot read property 'removeChild' of null
I couldn't reproduce the error in the repl and I also can't post the data since it is confidential. I'll try to post as much information as possible though. This is the component: ``` {#each schueler as s (s.ID)} {#each s.abschnitte.filter(aktJahr) as a (a.ID)} <Voffset/>{a.Jahr} {/each} {/each} <script> import Voffset from './partials/Voffset.html' // the file looks like this // ./partials/Voffset.html // <div></div> export let jahr, schueler // schueler looks like this just way more complex and about 1MB in size // schueler = [{abschnitte: [{Jahr: 2017},{Jahr: 2018}]}, {abschnitte: [{Jahr: 2017},{Jahr: 2018}]}] $: aktJahr = a => a.Jahr === jahr </script> ``` ``` svelte = new Component({ target: document.querySelector('svelte'), props }) ``` this works just fine. later on when I change some props I do it like this: ``` svelte.$set({ jahr: abschnitt.jahr, abschnitt: abschnitt.abschnitt }) ``` sometimes it works, sometimes not. It renders the component but then fails and I can't change the data again. This is the error message: ``` internal.mjs:111 Uncaught (in promise) TypeError: Cannot read property 'removeChild' of null at detachNode (VM110 bundle.js:113) at Object.destroy [as d] (VM110 bundle.js:1555) at destroyBlock (VM110 bundle.js:1006) at on_outro (VM110 bundle.js:1012) at run (VM110 bundle.js:23) at Array.forEach (<anonymous>) at run_all (VM110 bundle.js:31) at check_outros (VM110 bundle.js:535) at Object.update [as p] (VM110 bundle.js:1675) at update (VM110 bundle.js:937) ``` this seems to only happen with two nested loops and the imported component.
https://github.com/sveltejs/svelte/issues/2086
https://github.com/sveltejs/svelte/pull/6910
d39920fb102a66e0bc4301c7dd633ea748648e60
84ea242666174a405d27a46e19d148d1ef622875
2019-02-15T19:20:15Z
javascript
2022-11-07T12:09:01Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
2,085
["site/src/routes/blog/rss.xml.js"]
Fix pubDate in rss
I mentioned this in #2075 Looking at https://svelte.technology/blog/rss.xml I see that pubDate is not in the correct format. According to [W3 Validator for RSS 2.0](https://validator.w3.org/feed/docs/rss2.html) `pubDate` must be written according to [RFC 822](http://www.faqs.org/rfcs/rfc822.html). A tool like Feedly does not screw up here (I guess, they're scraping web content and using a database). However, using a feed reader like [Feeder](https://f-droid.org/de/packages/com.nononsenseapps.feeder/) gets tripped up by the current format. That is, it always shows the date of fetching as `pubDate`. Check [W3 Validator](https://validator.w3.org/feed/check.cgi?url=https%3A%2F%2Fsvelte.technology%2Fblog%2Frss.xml) during implementation.
https://github.com/sveltejs/svelte/issues/2085
https://github.com/sveltejs/svelte/pull/2087
d61616e148156451880b490dfba5af09e96fb859
845dd47fe80570948dbcb72db2a3b5613bfe609c
2019-02-15T19:00:49Z
javascript
2019-02-17T15:05:34Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
2,084
["src/compile/Component.ts", "src/compile/wrapModule.ts", "src/interfaces.ts"]
Remove output `format: 'eval'`?
The compiler output option `format: 'eval'` seems pretty useless in v3. I'm not sure how we would be able to support it now that we are relying on a bundler so much more heavily. Should this option simply be removed?
https://github.com/sveltejs/svelte/issues/2084
https://github.com/sveltejs/svelte/pull/2089
15931af63e1af4cf082938fdb733ff0305086101
54b5ce381357b07b443a8dc59c064f665d832d04
2019-02-15T00:27:42Z
javascript
2019-02-17T16:08:28Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
2,079
["CHANGELOG.md", "src/compiler/compile/render_dom/wrappers/Element/create_slot_block.ts", "src/compiler/compile/render_dom/wrappers/Element/index.ts", "src/compiler/compile/render_dom/wrappers/Slot.ts", "src/compiler/compile/render_ssr/handlers/Slot.ts", "test/runtime/samples/component-slot-nested-in-slot/One.svelte", "test/runtime/samples/component-slot-nested-in-slot/Two.svelte", "test/runtime/samples/component-slot-nested-in-slot/_config.js", "test/runtime/samples/component-slot-nested-in-slot/main.svelte"]
<slot slot="…"> (for passing slots through to child components) silently fails
Demo: https://v3.svelte.technology/repl?version=3.0.0-beta.3&gist=853e7d404576d323ca476f7db99ee3d0 It’s reasonable to want to pass a slot through to a child component; the natural way to do this without adding a new DOM node is like this: ```html <slot name="foo" slot="foo"></slot> ``` Unfortunately, this doesn’t work, and silently does doesn’t render the slot. The current workaround is the same as for using components as a slot: create a regular DOM element and use *that* as the slot: ```html <div slot="foo"> <slot name="foo"></slot> </div> ``` Vaguely related to #1037/#1713 which are about `slot` not yet working on components (it currently explicitly fails at compile time with a helpful message, which is a much happier failure mode).
https://github.com/sveltejs/svelte/issues/2079
https://github.com/sveltejs/svelte/pull/4295
0645631b28bc9d3429268ef5d2d1ead0feee77f9
8056829a9163a09930a453aff42dacf711943549
2019-02-13T12:13:23Z
javascript
2020-09-29T15:55:44Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
2,072
["store.mjs", "test/store/index.js"]
Add second argument to `writable`
I think I've found a use case that isn't served by `writable` and `readable` — namely, it's not possible for a writable store to know whether or not it has any subscribers, and it's very difficult to change the parameters of a readable store after it's been created. This bit me in a Sapper app today — I have a component that fetches a lot of paginated data for a given profile. If the user navigates away, the store should stop fetching data if it hasn't reached the end already. If the user navigates to a sibling page, the store should fetch data for the new profile instead. (It might be simpler in that case just to create a new store instead, but #2014 prevents that, and in any case it's not a general solution.) Proposed change: ```diff -export function writable(value) { +export function writable(value, start = noop) { + let stop; const subscribers = []; function set(newValue) { if (newValue === value) return; value = newValue; subscribers.forEach(s => s[1]()); subscribers.forEach(s => s[0](value)); } function update(fn) { set(fn(value)); } function subscribe(run, invalidate = noop) { const subscriber = [run, invalidate]; subscribers.push(subscriber); + if (subscribers.length === 1) stop = start() || noop; run(value); return () => { const index = subscribers.indexOf(subscriber); if (index !== -1) subscribers.splice(index, 1); + if (subscribers.length === 0) stop(); }; } return { set, update, subscribe }; } ``` This would make it possible to do this sort of thing: ```js function create_custom_store() { let params; let fetcher; const { set, subscribe } = writable(null, () => { fetcher = new Fetcher(params, set); return () => { fetcher.stop(); fetcher = null; }; }); return { set_params(value) { params = value; if (fetcher) fetcher.update_params(params); }, subscribe } } ``` Does this seem like a good solution? Am I missing anything?
https://github.com/sveltejs/svelte/issues/2072
https://github.com/sveltejs/svelte/pull/2091
5c704561239d9b229de3bd6627467ddaf9ecdda2
3f3803e1e47ba0799a6c615a451c781826578a22
2019-02-08T22:56:22Z
javascript
2019-02-17T17:51:47Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
2,068
["CHANGELOG.md", "site/content/docs/02-template-syntax.md", "site/content/tutorial/05-events/03-event-modifiers/text.md", "src/compiler/compile/nodes/Element.ts", "src/compiler/compile/render_dom/wrappers/Element/EventHandler.ts", "test/js/samples/event-modifiers/expected.js", "test/js/samples/event-modifiers/input.svelte", "test/validator/samples/event-modifiers-invalid-nonpassive/errors.json", "test/validator/samples/event-modifiers-invalid-nonpassive/input.svelte", "test/validator/samples/event-modifiers-invalid/errors.json"]
Allow opt-out of Chrome's passive event listener 'intervention'
Chrome have decided to [break the web](https://developers.google.com/web/updates/2017/01/scrolling-intervention) by assuming that touch/wheel events are passive unless you explicitly pass `passive: false`. Aside from philosophical concerns about breaking older apps that are no longer maintained, this makes life harder for Svelte, since there's no way to declaratively state that an event listener should be non-passive: ```html <!-- we can state that we're passive... --> <div on:touchstart|passive={handler}>...</div> <!-- or we can leave it ambiguous... --> <div on:touchstart={handler}>...</div> <!-- but there's no option for 'i need to use preventDefault' --> ``` Possible solution: add an `active` modifier: ```html <!-- signals that `handler` calls `event.preventDefault()` --> <div on:touchstart|active={handler}>...</div> ```
https://github.com/sveltejs/svelte/issues/2068
https://github.com/sveltejs/svelte/pull/5442
41d1656458b8e2643e3751f27f147b58428d6024
a1651ca271d65dcb563368a3a8f1dbac211bf36c
2019-02-07T21:07:32Z
javascript
2020-09-24T19:54:54Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
2,061
["src/compile/render-dom/wrappers/Slot.ts", "src/compile/render-ssr/handlers/Element.ts", "src/compile/render-ssr/handlers/Slot.ts", "src/utils/get_slot_data.ts", "src/utils/stringify_attribute.ts", "test/runtime/samples/component-slot-let-static/Nested.html", "test/runtime/samples/component-slot-let-static/_config.js", "test/runtime/samples/component-slot-let-static/main.html"]
Error with static slot scope values
A slot with a static scope value (`<slot value="Hi" />`) tries to get a variable named `Hi`, throwing `Hi is not defined`. REPL: https://v3.svelte.technology/repl?version=3.0.0-beta.1&gist=7d9d362f30f917013bf8d91e9364b28d
https://github.com/sveltejs/svelte/issues/2061
https://github.com/sveltejs/svelte/pull/2065
52d78fb697f952d3d1a03b2347cfc22339c07db0
da11d755582ca0fc18fbb2cc9249de488750de79
2019-02-06T19:44:38Z
javascript
2019-02-07T18:14:53Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
2,060
["store.mjs", "test/store/index.js"]
Any way to read the value of a writable?
In my store.js, I may have: `const player = writable({name: 'Player A', highScore: 50}); ` I may need a function in the store file: ``` const tick = (latestScore) => { const highScore = player. highScore; if (latestScore > highScore) { //set the player's highScore... } } ``` The idea would be that e.g main.js could invoke 'tick' whenever it needed to and pass in a score, which would conditionally update based on a read. A delightfully simple task...until the the "reading" of the player's highScore. Obvs, binding this value in a visual component works fine. But, short of using OCR to watch my screen, I have not discovered how to extract data from a writable object in code :-)
https://github.com/sveltejs/svelte/issues/2060
https://github.com/sveltejs/svelte/pull/2145
d15acd89cceda56afa9ab367dcda68e30788848f
03f74c1505b851cb94bc69c6bf5ca176d95e5c9d
2019-02-06T17:07:44Z
javascript
2019-03-02T18:56:07Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
2,059
["src/compile/Component.ts", "src/compile/render-dom/index.ts", "src/compile/render-ssr/index.ts", "test/runtime/samples/reactive-values-implicit/_config.js", "test/runtime/samples/reactive-values-implicit/main.html", "test/stats/samples/implicit-reactive/_config.js", "test/stats/samples/implicit-reactive/input.html"]
Auto-declare variables in reactive declarations, in certain cases
At present you have to declare all variables that are assigned to in reactive declarations: ```js let b; $: b = a + 1; ``` It would be much nicer to just do this: ```js $: b = a + 1; ``` In other words if the body is an `ExpressionStatement` whose expression is an `AssignmentExpression` whose left hand side is an `Identifier`, inject the `let b`.
https://github.com/sveltejs/svelte/issues/2059
https://github.com/sveltejs/svelte/pull/2062
e525b83d159928e85d494989ff02789b136afdf8
809039910b4718bfb208ac1918f0b6e0f5240f3e
2019-02-06T15:12:58Z
javascript
2019-02-06T23:58:36Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
2,056
["store.mjs"]
Derived store function with no arguments is never set
In the following example, the value `t` is never set, it remains `undefined`. ```js import i18next from 'i18next'; export const language = writable(i18next.language || ''); language.subscribe(value => i18next.changeLanguage(value)); // Update the function because internally the language has been updated export const t = derive([ language ], () => i18next.t.bind(i18next)); ``` The derived function is run, but the value is never set.
https://github.com/sveltejs/svelte/issues/2056
https://github.com/sveltejs/svelte/pull/2057
aac2cb17b3c0a09d8b08c437c60ce86f2b71eb98
e525b83d159928e85d494989ff02789b136afdf8
2019-02-05T21:49:46Z
javascript
2019-02-06T15:25:22Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
2,055
["src/compile/Component.ts", "test/runtime/samples/reactive-values-non-cyclical/_config.js", "test/runtime/samples/reactive-values-non-cyclical/main.html", "test/validator/samples/reactive-declaration-cyclical/errors.json", "test/validator/samples/reactive-declaration-cyclical/input.html"]
Cyclical dependency detection fails to account for scope
This throws an incorrect 'Cyclical dependency detected' error, because it thinks `b` depends on `a`: ```html <script> export let x; let a; let b; $: a = b; $: b = (function(a) { return a; }(x)); </script> ```
https://github.com/sveltejs/svelte/issues/2055
https://github.com/sveltejs/svelte/pull/2063
be3808dd08817412a4e3f380732e1a991ab2fc40
3dab978bc14c9c402f59813769ee1fb1dc9f0ce1
2019-02-05T19:39:10Z
javascript
2019-02-07T16:21:45Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
2,054
["src/compile/Component.ts", "test/js/samples/reactive-values-non-topologically-ordered/expected.js", "test/js/samples/reactive-values-non-topologically-ordered/input.html"]
Reactive declarations are emitted twice
If reactive declarations [aren't written in topological order](https://v3.svelte.technology/repl?version=3.0.0-beta.1&gist=e4ac1a9530cfdfd53016c46191b342c7)... ```html <script> export let x; let a; let b; $: a = b; $: b = x; </script> ``` ...they get duplicated: ```js $$self.$$.update = ($$dirty = { b: 1, x: 1, a: 1 }) => { if ($$dirty.b || $$dirty.x) { b = x; $$invalidate('b', b); } if ($$dirty.a || $$dirty.b) { a = b; $$invalidate('a', a); } if ($$dirty.b || $$dirty.x) { b = x; $$invalidate('b', b); } }; ```
https://github.com/sveltejs/svelte/issues/2054
https://github.com/sveltejs/svelte/pull/2064
3dab978bc14c9c402f59813769ee1fb1dc9f0ce1
cf775486cf956ba699ba9616f1091fa8f444d597
2019-02-05T19:04:00Z
javascript
2019-02-07T16:25:36Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
2,053
["src/internal/style_manager.js"]
snapping `in` transitions when an `out` is also present. (3.0.0-beta.2)
There seems to be some strange behaviour with `in` transitions when there are multiple transitions. The element transitioning in seems to snap in as soon as the element transitioning out has dismounted (I think). Which is to say the transition proceeeds normally until the other element has finished its outro, at which point it skips to the end position, I'm guessing the `in` animation is being incorrectly removed when the `out` animation is removed. This only occurs for the first few plays of the animation, after which it rectifies itself (I do not know why), to recreate, load the below REPL. After it starts behaving, to repeat the behaviour, select 'JS Output', then switch back to see it again. Simply modifying the code to force a reload/recompile doesn't seem to 'reset' it the same way a reload does. [REPL Link](https://v3.svelte.technology/repl?version=3.0.0-beta.2&gist=a6f7333d6933b59591e1fcae4674943a)
https://github.com/sveltejs/svelte/issues/2053
https://github.com/sveltejs/svelte/pull/2237
cdbd0c3c18e22bceb929263a00cb8cbecf7346dc
088bb7bcd0dfbba098ec6f246ab39acd7e806ee6
2019-02-05T18:02:57Z
javascript
2019-03-16T21:42:07Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
2,052
["src/compile/render-dom/index.ts", "test/js/samples/reactive-values-non-writable-dependencies/expected.js", "test/js/samples/reactive-values-non-writable-dependencies/input.html"]
Only account for reassigned/mutated vars in reactive dirty checks
In [this example](https://v3.svelte.technology/repl?version=3.0.0-beta.1&gist=8aaa43f0fe81a2f66ac76a38fc04fb66)... ```html <script> let a = 1; let b = 2; let max; $: max = Math.max(a, b); </script> <label> <input type=range bind:value={a}> a = {a} </label> <label> <input type=range bind:value={b}> b = {b} </label> <p>max = {max}</p> ``` ...Svelte generates this code: ```js $$self.$$.update = ($$dirty = { max: 1, Math: 1, a: 1, b: 1 }) => { if ($$dirty.max || $$dirty.Math || $$dirty.a || $$dirty.b) { max = Math.max(a, b); $$invalidate('max', max); } }; ``` There's no need for `$$dirty.Math` — we can see it never changes.
https://github.com/sveltejs/svelte/issues/2052
https://github.com/sveltejs/svelte/pull/2066
cf775486cf956ba699ba9616f1091fa8f444d597
52d78fb697f952d3d1a03b2347cfc22339c07db0
2019-02-05T16:17:59Z
javascript
2019-02-07T17:02:01Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
2,042
["src/compile/nodes/shared/Node.ts", "test/validator/samples/empty-block-dev/_config.js", "test/validator/samples/empty-block-prod/input.svelte", "test/validator/samples/empty-block-prod/warnings.json", "test/validator/samples/empty-block/input.svelte", "test/validator/samples/empty-block/warnings.json"]
Proposal: `dev: true` only affects runtime warnings and errors
Right now, compiling with `dev: true` causes the compiler to emit a bunch of code to display additional runtime warnings and errors, to assist with debugging - and it also enables a compile-time warning for empty blocks. As far as I can tell, the empty blocks warning is the only compiler-time thing it affects. This seems weird, and I think it would be nicer if `dev: true` _only_ affected runtime things. This would mean that the empty block compile-time warning would always be emitted - so this issues can go along with #2040, which makes it simpler to suppress specific warnings at compile time.
https://github.com/sveltejs/svelte/issues/2042
https://github.com/sveltejs/svelte/pull/2092
fa1322b00b1e1ba815ea18406283abefa270b334
871147260c116fcf0b70d8cfcbe97c399c97bad9
2019-02-02T23:04:00Z
javascript
2019-02-17T17:35:17Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
2,038
["src/compile/Component.ts", "src/internal/utils.js", "test/runtime/samples/props-excludes-external/RenderProps.svelte", "test/runtime/samples/props-excludes-external/_config.js", "test/runtime/samples/props-excludes-external/main.svelte"]
Internal variables showing up in svelte:options bind:props
v3 alpha27 When using `<svelte:options bind:props` in a component where there is slot default content, the props object contains `$$slot_default` and `$$scope`. This causes an error when using the spread operator on html elements eg `<h1 {...props}` https://v3.svelte.technology/repl?version=3.0.0-alpha27&gist=b34f72aee305df48c06618219306d1db the `$` prefixed prop elements are not there if there is no default slot content
https://github.com/sveltejs/svelte/issues/2038
https://github.com/sveltejs/svelte/pull/2083
845dd47fe80570948dbcb72db2a3b5613bfe609c
94dfeec13ca359629343f01688ad01651a546c4d
2019-02-02T10:34:50Z
javascript
2019-02-17T15:06:10Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
2,037
["src/compile/Component.ts", "test/runtime/samples/prop-without-semicolon-b/_config.js", "test/runtime/samples/prop-without-semicolon-b/main.html"]
ASI confused by turning export statement into `$$props` destructuring
```html <script> export let foo, bar (() => {})() </script> ``` The `export` is turned into `let { foo, bar } = $$props` which causes a semicolon issue with the following line.
https://github.com/sveltejs/svelte/issues/2037
https://github.com/sveltejs/svelte/pull/2045
df318d29768921be24586995dbb4302c260914bf
11969cdfe7729d908712ad540e957b26d86526dc
2019-02-01T21:56:29Z
javascript
2019-02-04T03:05:22Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
2,036
["src/compile/Component.ts", "test/stats/samples/duplicate-globals/_config.js", "test/stats/samples/duplicate-globals/input.html", "test/stats/samples/duplicate-non-hoistable/_config.js", "test/stats/samples/duplicate-non-hoistable/input.html", "test/stats/samples/duplicate-vars/_config.js", "test/stats/samples/duplicate-vars/input.html"]
Can't use same global in instance and module scripts
```html <script context="module"> console.log(1); </script> <script> console.log(2); </script> ``` I think this is a simple fix — just need to check that `console` hasn't already been declared with `add_var` before adding it a second time
https://github.com/sveltejs/svelte/issues/2036
https://github.com/sveltejs/svelte/pull/2044
11969cdfe7729d908712ad540e957b26d86526dc
43d3bb08e49b8a7aae8d0d8fbcd1710d89665969
2019-01-31T22:24:21Z
javascript
2019-02-04T03:05:34Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
2,034
["src/compiler/compile/render_dom/wrappers/InlineComponent/index.ts", "src/compiler/compile/render_dom/wrappers/shared/bind_this.ts", "src/runtime/internal/scheduler.ts", "test/runtime/index.js", "test/runtime/samples/binding-this-element-reactive-b/_config.js", "test/runtime/samples/binding-this-element-reactive-b/main.svelte", "test/runtime/samples/transition-js-if-block-outro-timeout/_config.js"]
bound element references arent triggering subscriptions when changing to null
https://v3.svelte.technology/repl?version=3.0.0-alpha25&gist=da9c704874c5bfed8827c14d35c8e3b4 **Steps to Reproduce:** - Bind an element to a variable - use that variable in another attribute binding - wrap the bound element in an if block that will remove it from the dom - trigger the false condition for the if block and observe that the attribute binding referencing the variable is not updated. **Expected Behaviour?:** When an element goes out of scope its binding variable is set to null, any reactive subscriptions to that variable will be updated including template expressions and $ expressions. **Actual Behaviour:** Neither the template binding or a reactive $ binding are updated, the value of the reference is null when logged to console though.
https://github.com/sveltejs/svelte/issues/2034
https://github.com/sveltejs/svelte/pull/3145
8ffe03a04d58b210e030c81e954a5b12c15e0a3d
2915cf9cc33ab3325d4744d50e6ce7040b271c98
2019-01-31T14:36:11Z
javascript
2019-07-01T15:27:06Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
2,031
["src/compile/render-dom/wrappers/Element/index.ts", "test/runtime/samples/component-slot-nested-in-element/One.svelte", "test/runtime/samples/component-slot-nested-in-element/Two.svelte", "test/runtime/samples/component-slot-nested-in-element/_config.js", "test/runtime/samples/component-slot-nested-in-element/main.svelte"]
Nesting slots broke in alpha19
[REPL](https://v3.svelte.technology/repl?version=3.0.0-alpha24&gist=82d12c72e4da0e37e5573ce188570464) Nested provides a slot that should get injected into Sub. Since alpha19 it throws `Failed to execute 'appendChild' on 'Node': The new child element contains the parent.`.
https://github.com/sveltejs/svelte/issues/2031
https://github.com/sveltejs/svelte/pull/2097
d0b93ee4d708311df24285526b87ce9749d960d2
47ab23c1deb022aea48f61e79ad4ad1ed2289cfc
2019-01-30T19:57:51Z
javascript
2019-02-17T19:23:55Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,997
["src/compile/render-dom/wrappers/Element/Binding.ts", "src/compile/render-dom/wrappers/Element/index.ts", "test/runtime/samples/binding-store-deep/_config.js", "test/runtime/samples/binding-store-deep/main.html", "test/runtime/samples/binding-store/_config.js", "test/runtime/samples/binding-store/main.html"]
3.0.0-alpha18: select value binding against a store does not update all subscriptions
Hi, I'm trying to set a store value through a value binding of select input. After changing the select, the value get's updated correctly in the same component where the select is, but other components that may be subscribed to the same writable are not getting update. In contrast, if I exercise the writable.set() API to programmatically set the value of the writable store, the value updates correctly in all components that are subscribed. I have made a repro in the REPL. https://v3.svelte.technology/repl?version=3.0.0-alpha18&gist=17ec1020c2a1750931f4415883bbbe32 Cheers! Germán App.html ``` <script> import { currentLang } from './stores.js'; </script> Selected lang: {$currentLang} <select bind:value={$currentLang}> {#each langs as lang (lang.value) } <option value={lang.value}>{lang.text}</option> {/each} </select> ``` Nav.html ``` <script> import { currentLang } from './stores.js'; </script> <nav style="background-color: #eee"> Current lang <strong>{$currentLang}</strong> </nav> ```
https://github.com/sveltejs/svelte/issues/1997
https://github.com/sveltejs/svelte/pull/2010
9f800fb914010ae790eb856ad829687e50805732
80b0bdfdb19ec5abaaa9a9d0b350da9a3893ef26
2019-01-21T10:54:03Z
javascript
2019-01-29T03:06:05Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,989
["src/compile/render-dom/wrappers/Window.ts", "test/js/samples/window-binding-scroll/expected.js"]
Scroll bindings broken
https://v3.svelte.technology/repl?version=3.0.0-alpha18&demo=parallax
https://github.com/sveltejs/svelte/issues/1989
https://github.com/sveltejs/svelte/pull/1990
4d262c4d969a2e6a08e388b523b81af8063aa1d5
e8e0f4c8be0bc3ace5a56b07ee0ec1adf4e8675e
2019-01-18T15:46:31Z
javascript
2019-01-19T02:42:39Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,977
["src/compile/render-dom/Block.ts", "src/compile/render-dom/wrappers/Slot.ts", "src/utils/CodeBuilder.ts", "test/js/samples/if-block-no-update/expected.js", "test/js/samples/if-block-simple/expected.js", "test/js/samples/use-elements-as-anchors/expected.js", "test/runtime/samples/component-slot-used-with-default-event/Nested.html", "test/runtime/samples/component-slot-used-with-default-event/_config.js", "test/runtime/samples/component-slot-used-with-default-event/main.html"]
Event listeners in slots
REPL: https://v3.svelte.technology/repl?version=3.0.0-alpha16&gist=0bad4c3fd7428de50069a24a759dab95
https://github.com/sveltejs/svelte/issues/1977
https://github.com/sveltejs/svelte/pull/1978
4c9a55cb668e4ddf56c46987630fb0431a8049a1
f3701794be7261d35abf351f5ef8463d713d5de8
2019-01-10T15:22:48Z
javascript
2019-01-13T21:43:25Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,968
["src/compile/Component.ts", "src/compile/render-dom/index.ts", "test/runtime/samples/immutable-option/_config.js", "test/runtime/samples/immutable-option/main.html", "test/runtime/samples/immutable-root/_config.js", "test/runtime/samples/immutable-svelte-meta-false/_config.js", "test/runtime/samples/immutable-svelte-meta-false/main.html", "test/runtime/samples/immutable-svelte-meta/_config.js", "test/runtime/samples/immutable-svelte-meta/main.html"]
`<svelte:meta immutable/>` and `options.immutable`
Having `<svelte:meta immutable/>` set does not seem to find its way into into the generated code. `safe_not_equal` is still what's used to compare values. Also, `<svelte:meta immutable={false}/>` is a compiler error, which imo should be what the syntax actually is, not `<svelte:meta immutable='false'/>`. Having `options.immutable` set when compiling _does_ cause (the non-safe) `not_equal` to be used. Which of these should have precedence? (Is there a reason to have this as a compiler option, and not just as a component `svelte:meta` flag?) Whichever has precedence, we ought to have a way in the REPL to have the `immutable` compiler option set to 'not specified'.
https://github.com/sveltejs/svelte/issues/1968
https://github.com/sveltejs/svelte/pull/1982
a8f905f9334722c6ec47c579212e443157d34cde
773d94436caf6a8115a9dd798e5acc5ed2062057
2019-01-05T16:44:03Z
javascript
2019-01-16T01:39:17Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,963
["src/compile/render-dom/wrappers/Window.ts", "test/runtime/samples/window-binding-multiple-handlers/_config.js", "test/runtime/samples/window-binding-multiple-handlers/main.html"]
Malformed generated code with window bindings
https://v3.svelte.technology/repl?version=3.0.0-alpha16&gist=43969a7de7c0308e1a7c11cf6c1beff0 Uncomment the button to see the error. At first glance, it would seem that at https://github.com/sveltejs/svelte/blob/dcad65b118d932a10081ab74b89adf472437b600/src/compile/render-dom/wrappers/Window.ts#L117 there is a stray semicolon.
https://github.com/sveltejs/svelte/issues/1963
https://github.com/sveltejs/svelte/pull/1964
dcad65b118d932a10081ab74b89adf472437b600
2f8727d96846170803120e19897ef80ccdc11735
2019-01-05T01:11:54Z
javascript
2019-01-05T02:58:32Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,960
["src/parse/state/tag.ts", "test/runtime/samples/prop-not-action/Nested.html", "test/runtime/samples/prop-not-action/_config.js", "test/runtime/samples/prop-not-action/main.html"]
Props starting with "use" are interpreted as action
When using a prop called user (`<Nested user={currentUser}/>`) it throws `Actions can only be applied to DOM elements, not components`.
https://github.com/sveltejs/svelte/issues/1960
https://github.com/sveltejs/svelte/pull/1962
2f8727d96846170803120e19897ef80ccdc11735
4676946e835abfd82de1e1261e6797fa981a6fd9
2019-01-04T18:23:44Z
javascript
2019-01-05T02:58:46Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,957
["src/compile/Component.ts", "test/js/samples/deconflict-builtins/expected.js", "test/js/samples/select-dynamic-value/expected.js", "test/runtime/samples/event-handler-deconflicted/_config.js", "test/runtime/samples/event-handler-deconflicted/main.html"]
Event handlers not deconflicted with other identifiers
```html <button type='button' on:click={() => foo()}>Blah</button> {click_handler} ```
https://github.com/sveltejs/svelte/issues/1957
https://github.com/sveltejs/svelte/pull/1961
4676946e835abfd82de1e1261e6797fa981a6fd9
76faa924640e1bfa4565c9391f22035d269903df
2019-01-04T10:14:54Z
javascript
2019-01-05T02:59:01Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,949
["package-lock.json", "package.json", "src/parse/acorn.ts", "src/parse/read/expression.ts", "src/parse/read/script.ts"]
Upgrade to Acorn 6
This should probably be considered a breaking change (since Svelte exposes Acorn parsing options), and so it would be nice to get this into Svelte 3. I believe the main changes in Acorn 6 are that the walker is now a separate package (but I don't think we were using that walker anyway) and that plugins work differently. It also switches the default ECMA version to 2018, and I believe built-in support for that is now pretty good, so we might not need any plugins at all actually.
https://github.com/sveltejs/svelte/issues/1949
https://github.com/sveltejs/svelte/pull/1958
76faa924640e1bfa4565c9391f22035d269903df
c1ee21b022cf59d1682ecec0a11c9ad9e9a48d94
2019-01-03T10:01:04Z
javascript
2019-01-05T02:59:13Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,948
["src/parse/state/tag.ts", "test/parser/samples/error-svelte-selfdestructive/error.json", "test/parser/samples/error-svelte-selfdestructive/input.html"]
svelte:component and svelte:self parsed too loosely
`<svelte:componentfoo` and `<svelte:selffoo` are both accepted and parsed as `<svelte:component foo` and `<svelte:self foo`, because of how they are parsed: `if (parser.eat(SELF))` and `if (parser.eat(COMPONENT))`. We should go up to the next whitespace, forward slash, or greater then - like we do with other tag names. This is present in v2 and v3.
https://github.com/sveltejs/svelte/issues/1948
https://github.com/sveltejs/svelte/pull/1965
c1ee21b022cf59d1682ecec0a11c9ad9e9a48d94
88b6a26a355887d470a4fdaf5583218d62747899
2019-01-03T09:53:34Z
javascript
2019-01-05T04:02:25Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,946
["src/internal/animations.js", "src/internal/style_manager.js"]
intro transitions broken in alpha > 13
See the official [REPL](https://v3.svelte.technology/repl?version=3.0.0-alpha15&demo=transitions-in-out) - outro works, intro doesn't.
https://github.com/sveltejs/svelte/issues/1946
https://github.com/sveltejs/svelte/pull/1947
16fea037f3aca382b1f832966e9e6471b3fb8bc4
b65828b2695e644e935659913a8e2d3cf0131205
2019-01-03T00:20:16Z
javascript
2019-01-03T01:18:50Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,945
["src/compile/render-dom/wrappers/InlineComponent/index.ts"]
Cannot dispatch events from dynamic components
[REPL](https://v3.svelte.technology/repl?version=3.0.0-alpha15&gist=443187366e7fb07c816372c9b75123fd): Clicking the button throws `Cannot read property 'call' of undefined`. The list of callbacks contains an undefined item.
https://github.com/sveltejs/svelte/issues/1945
https://github.com/sveltejs/svelte/pull/1966
efa7ad64c153b497427b32381fa3c788c680412b
678ce3496fd540cf0ea59f1c32c9db618fc84292
2019-01-03T00:15:38Z
javascript
2019-01-13T19:29:54Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,939
["src/compile/render-dom/wrappers/AwaitBlock.ts", "test/runtime/samples/await-containing-if/_config.js", "test/runtime/samples/await-containing-if/main.html"]
if inside an await block mounts to an undefined element
Happy new year! Here's another bug I've run into on the latest v3 alpha. I'm not sure whether this is also present in v2.x. For the code below, the compiler generates code that doesn't mount the `if_block` properly when the condition changes. Here is a full example in the [REPL](https://v3.svelte.technology/repl?version=3.0.0-alpha13&gist=4deb4bbb73e89fd8b74612852ab06d81). ```html {#await p1} <p>...</p> {:then name} {#if show} <h1>Hello {name}</h1> {/if} {:catch err} <p>{err}</p> {/await} ``` Looking at the generated code, the `div` passed to `if_block.m(div, if_anchor)` is undefined. ```js // snippet from create_then_block p(changed, ctx) { if (ctx.show) { if (if_block) { if_block.p(changed, ctx); } else { if_block = create_if_block(component, ctx); if_block.c(); if_block.m(div, if_block_anchor); } } else if (if_block) { if_block.d(1); if_block = null; } }, ``` Wrapping the if block in an actual `<div>` does make things work as expected.
https://github.com/sveltejs/svelte/issues/1939
https://github.com/sveltejs/svelte/pull/1967
0ea384004626bab8c86104a9a907460b72aa7c7f
2d3dbdd6a97d395408d0ae1eed3d4495bcc7d09e
2019-01-01T21:08:29Z
javascript
2019-01-13T19:19:55Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,933
["src/compile/Component.ts", "src/compile/nodes/Animation.ts", "src/compile/nodes/shared/Expression.ts", "src/compile/render-dom/index.ts", "src/compile/render-dom/wrappers/Element/index.ts", "test/runtime/samples/animation-js-easing/_config.js", "test/runtime/samples/animation-js-easing/easing.js", "test/runtime/samples/animation-js-easing/main.html"]
Animate directive functions must be exported to be used with an easing function
When using `animate` directives the correspdoning function must be marked as an `export` in order to be used with an easing function. Without an easing function they work fine, any reference to an easing function within the function body causes the animation to fail (even if it is just a `console.log()`). This bug is present with imported easing functions and easing functions defined outside of the body of the animate function. If the easing is inlined or the definition appears inside of the animate function body, it works fine. [REPL Link](https://v3.svelte.technology/repl?version=3.0.0-alpha12&gist=4dd95924742856ae7459637b8f4b5fc6) — Remove the export to break the example. ✅ Easing functions defined with the animation function body work fine: ```js function animate(node, {from, to}, params) { const x = from.left - to.left; const easing = t => --t * t * t * t * t + 1; return { duration: 300, easing, css: (t, u) => `transform: translateX(${u * x}px);` } }; ``` ✅ As do inline easing functions: ```js function animate(node, {from, to}, params) { const x = from.left - to.left; return { duration: 300, easing: t => --t * t * t * t * t + 1, css: (t, u) => `transform: translateX(${u * x}px);` } }; ``` ✅ Marking the animation function as an export causes them to behave normally: ```js const easing = t => --t * t * t * t * t + 1; export function animate(node, {from, to}, params) { const x = from.left - to.left; return { duration: 300, easing, css: (t, u) => `transform: translateX(${u * x}px);` } }; ``` ❌ Removing the export causes the function to fail (same behaviour with imported easing functions): ```js const easing = t => --t * t * t * t * t + 1; function animate(node, {from, to}, params) { const x = from.left - to.left; return { duration: 300, easing, css: (t, u) => `transform: translateX(${u * x}px);` } }; ```
https://github.com/sveltejs/svelte/issues/1933
https://github.com/sveltejs/svelte/pull/1935
cc9a172d7c3ed152a261294dd19d4e6c96c06fbd
d6552025e458f236a700456f4ec08e1e724df9a2
2018-12-30T23:00:43Z
javascript
2018-12-31T15:48:06Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,920
["src/compile/Component.ts", "test/js/samples/dev-warning-missing-data-computed/expected.js", "test/runtime/samples/reactive-values-readonly/_config.js", "test/runtime/samples/reactive-values-readonly/main.html"]
Prevent writing to 'computed' values
[REPL](https://v3.svelte.technology/repl?version=3.0.0-alpha12&gist=589305828c887b6e7236e348db1393dd). Ideally, it wouldn't be possible to set `doubled` from outside `Nested`, because its value is set reactively. Re-running reactive declarations when their assignees are dirty (as well as when theire dependents are dirty) *should* fix this, I think. It does mean adding new `if ($$dirty.xxx)` conditions though, which makes the bitmask idea even more appealing
https://github.com/sveltejs/svelte/issues/1920
https://github.com/sveltejs/svelte/pull/1993
6036f00dee14c731a6ce8535a42be80e317a4015
ff6e378fcbf12e4ab2647eefda3048d25f3e2ad2
2018-12-28T17:30:03Z
javascript
2019-01-20T17:19:37Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,919
["src/compile/render-dom/wrappers/Element/index.ts", "test/runtime/samples/binding-input-text-contextual-deconflicted/_config.js", "test/runtime/samples/binding-input-text-contextual-deconflicted/main.html"]
Event handlers not deconflicted when one is binding inside each loop and one outside
```html <input bind:value={foo}> {#each [] as bar} <input bind:value={bar}> {/each} ``` results in code that look like ```javascript function input_input_handler() { foo = this.value; $$invalidate('foo', foo); } function input_input_handler({ bar, each_value, bar_index }) { each_value[bar_index] = this.value; } ``` (Aside: I can't believe this isn't a syntax error, and that I had to find this out by my app not working. Thanks, javascript.)
https://github.com/sveltejs/svelte/issues/1919
https://github.com/sveltejs/svelte/pull/1923
4cb2b8dc9049c84749427f95e741258d01dca08d
11e8270963b8f6764f6c412ceb1e5de36ef5e845
2018-12-28T15:23:40Z
javascript
2018-12-29T05:13:33Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,918
["src/compile/Component.ts", "src/compile/css/Stylesheet.ts", "src/compile/index.ts", "src/compile/wrapModule.ts", "src/interfaces.ts", "test/css/index.js", "test/validator/index.js"]
`stats.warnings` does not include all warnings
`stats.warnings` does not include any unused CSS selector warnings. There may be other warnings it's missing. We need to call `stats.warn` instead of `options.onwarn` whenever we have a warning. This is present in v2 and v3.
https://github.com/sveltejs/svelte/issues/1918
https://github.com/sveltejs/svelte/pull/1926
ff2a21e63ad243c6e19a7ac84e69021d3a788a9e
4cb2b8dc9049c84749427f95e741258d01dca08d
2018-12-28T04:58:51Z
javascript
2018-12-29T05:12:23Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,914
["src/compile/nodes/Element.ts", "src/compile/nodes/EventHandler.ts", "test/js/samples/event-handler-no-passive/expected.js", "test/js/samples/event-handler-no-passive/input.html", "test/js/samples/event-modifiers/input.html"]
`passive: true` is applied to events incorrectly
[REPL](https://v3.svelte.technology/repl?version=3.0.0-alpha12&gist=d52fe6c7022188241e15190f2cbd4de2). In v3, Svelte assumes you're never using the `event` object, so it applies the `passive: true` modifier more liberally.
https://github.com/sveltejs/svelte/issues/1914
https://github.com/sveltejs/svelte/pull/1929
cd4f987f4ed53086510962b29a14c337f3d2cf8f
fc0ef221aff4789c7c579932e70c5f8243e97f32
2018-12-24T22:50:22Z
javascript
2018-12-29T18:19:03Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,908
["src/compile/render-dom/wrappers/Element/index.ts", "test/runtime/samples/binding-this-and-value/_config.js", "test/runtime/samples/binding-this-and-value/main.html"]
v3: Bindings broken when binding this and value
Here's a [REPL](https://v3.svelte.technology/repl?version=3.0.0-alpha9&gist=06e5b13e5ca1b9fb811f4178843b1e87) - when typing into the input, `$$node is not defined` is thown and the binding not updated.
https://github.com/sveltejs/svelte/issues/1908
https://github.com/sveltejs/svelte/pull/1910
fefe0a246fdf67009bb0f323b62193aec1590859
35f57c02125014b3953538a360de6c868113ee36
2018-12-23T20:45:35Z
javascript
2018-12-23T21:55:40Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,898
["src/compile/render-dom/wrappers/Element/index.ts", "test/js/samples/bind-width-height/expected.js"]
resize bindings broken in v3
The handler isn't being called with the element as context https://v3.svelte.technology/repl?version=3.0.0-alpha8&gist=0eb9e3a2d22b981b67924c326ed1293a
https://github.com/sveltejs/svelte/issues/1898
https://github.com/sveltejs/svelte/pull/1909
8faa6a661b854bf5f72e0f0193ac24c54b5b701e
fefe0a246fdf67009bb0f323b62193aec1590859
2018-12-22T20:51:06Z
javascript
2018-12-23T21:55:23Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,896
["src/compile/nodes/Binding.ts", "src/compile/render-dom/Block.ts", "src/compile/render-dom/wrappers/EachBlock.ts", "src/compile/render-dom/wrappers/Element/Binding.ts", "src/compile/render-dom/wrappers/Element/index.ts", "src/compile/render-dom/wrappers/InlineComponent/index.ts", "test/js/samples/input-files/expected.js", "test/js/samples/media-bindings/expected.js"]
Media bindings broken in v3
https://v3.svelte.technology/repl?version=3.0.0-alpha8&demo=binding-media-elements
https://github.com/sveltejs/svelte/issues/1896
https://github.com/sveltejs/svelte/pull/1934
f8517edba9fe99c95c9723d97f168455c6afd19a
c0a8e630e36bfa5eb8b3b726f0bfa3d133a285c2
2018-12-22T18:48:38Z
javascript
2018-12-31T14:43:20Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,894
["src/compile/render-dom/index.ts", "src/utils/globalWhitelist.ts", "test/runtime/index.js", "test/runtime/samples/globals-accessible-directly-process/_config.js", "test/runtime/samples/globals-accessible-directly-process/main.html", "test/server-side-rendering/index.js"]
Implicit props can break stuff
This component... ```html <p>process.env.BASEURL: {process.env.BASEURL}</p> ``` ...doesn't work, whereas this one does: ```html <script> // ... </script> <p>process.env.BASEURL: {process.env.BASEURL}</p> ``` That's because `process` is assumed to be an implicit prop in the first case. Whitelisted globals are ignored, so `<p>{Math.max(1, 2)</p>` works just fine, but I wonder if we should have a fallback in place for unknown globals.
https://github.com/sveltejs/svelte/issues/1894
https://github.com/sveltejs/svelte/pull/1930
fc0ef221aff4789c7c579932e70c5f8243e97f32
e7642db13dcb1dceca5e5e1a2abfbc6ec961a97b
2018-12-22T15:08:18Z
javascript
2018-12-29T19:19:52Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,889
["package-lock.json", "package.json", "src/compile/Component.ts", "test/runtime/samples/store-auto-subscribe-in-script/_config.js", "test/runtime/samples/store-auto-subscribe-in-script/main.html"]
Create implicit values for stores referenced with $ prefix anywhere in script
Currently, referencing a reactive store `foo` as `$foo` works in templates and in reactive declarations. There's no real reason that shouldn't be extended to apply *anywhere* in the instance `<script>` block — especially since referencing `$foo` in an event handler *already* works if you've referenced `$foo` in one of the 'approved' ways.
https://github.com/sveltejs/svelte/issues/1889
https://github.com/sveltejs/svelte/pull/1941
c6d2cdddb034d0b0524ddab4173345318dd3a600
45d375e15d9841da27e033a26a36e431b389a66e
2018-12-20T04:23:05Z
javascript
2019-01-01T23:21:28Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,883
["src/compile/render-dom/index.ts", "src/compile/render-ssr/index.ts", "test/runtime/samples/store-auto-subscribe-implicit/_config.js", "test/runtime/samples/store-auto-subscribe-implicit/main.html"]
Using store autosubscription in template without instance script generates invalid code
```html {$foo} ``` This generates code that attempts to declare `$foo` twice. If we want to allow this syntax, I would _think_ it should just have an implicit prop `foo`, and not `$foo`. In the compiler's current state, I don't think we can rely on `this.template_references` to get the implicit props anymore. (This is also somewhat adjacent to the issue of maintaining a list of all implicit/hidden references included in the scripts and template for the purposes of linting.)
https://github.com/sveltejs/svelte/issues/1883
https://github.com/sveltejs/svelte/pull/1936
d6552025e458f236a700456f4ec08e1e724df9a2
be93d7d0e7e5feb7dd620352e2a2f9bb7cbd812d
2018-12-17T13:24:19Z
javascript
2018-12-31T16:52:56Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,881
["site/src/routes/guide/index.html", "src/compile/render-dom/wrappers/Element/index.ts", "src/internal/Component.js", "src/internal/scheduler.js"]
intro transitions and events aren't running when in dev mode
Intro transitions are not running regardless of whether they are defined as `in` or `transition`. `introstart` and `introend` events also do not fire. This only seems to happen in `dev` mode which is probably why the test aren't picking it up. [REPL Link](https://svelte3.conduitry.io/repl?version=3.0.0-alpha6&gist=426da040429120517ce35677d9c15aab) A glance at the compiled code shows that `intro.enabled` is the condition which must be met to add those render callbacks. `intro.enabled` is an imported module with a static false value as far as I can see. As I say, this is just in `dev` mode.
https://github.com/sveltejs/svelte/issues/1881
https://github.com/sveltejs/svelte/pull/1903
8ef88729a859b6d8bb29a5b3c755c9f268e27c95
4140531d92973d99649394aee37f36cb5f4198ae
2018-12-16T23:49:01Z
javascript
2018-12-23T14:06:00Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,859
["src/compile/render-dom/wrappers/Window.ts"]
Can't create multiple window bindings
If I create a component that binds to more than one property on the window using `svelte:window` I get a parser error. It looks like the JavaScript that Svelte is generating is forgetting to put in commas when setting multiple properties. This is with Sapper 0.22.10 and Svelte 2.15.3. ``` Module parse failed: Unexpected token You may need an appropriate loader to handle this file type. | component.set({ | w: this.innerWidth > h: this.innerHeight | }); ``` I don't see the stacktrace in the REPL, but you can see that it doesn't work with this example: https://svelte.technology/repl?version=2.15.3&gist=d7613ec25e703975727eb08a00abb450 Delete either of the bindings in there, and the component will build and mount. <!-- Thanks for raising an issue! (For *questions*, we recommend instead using https://stackoverflow.com and adding the 'svelte' tag.) To help us help you, if you've found a bug please consider the following: * If you can demonstrate the bug using https://svelte.technology/repl, please do. * If that's not possible, we recommend creating a small repo that illustrates the problem. * Make sure you include information about the browser, and which version of Svelte you're using Reproductions should be small, self-contained, correct examples – http://sscce.org. Occasionally, this won't be possible, and that's fine – we still appreciate you raising the issue. But please understand that Svelte is run by unpaid volunteers in their free time, and issues that follow these instructions will get fixed faster. If you have a stack trace to include, we recommend putting inside a `<details>` block for the sake of the thread's readability: <details> <summary>Stack trace</summary> Stack trace goes here... </details> -->
https://github.com/sveltejs/svelte/issues/1859
https://github.com/sveltejs/svelte/pull/1870
09e6ae0e8e45ef9e08f99930a96a74975de63817
d236a4ad0b6f87c2e6e61563f800b01c8731700e
2018-11-20T22:23:30Z
javascript
2018-12-09T03:04:36Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,852
["src/compile/render-dom/wrappers/Element/Attribute.ts", "test/runtime/samples/attribute-unknown-without-value/_config.js", "test/runtime/samples/attribute-unknown-without-value/main.html"]
No attribute value rendered as "true"
I'd like to render an element attribute with an optional value. For example, ```html <div no-value></div> ``` However, svelte is rendering this with the value of "true", ```html <div no-value="true"></div> ``` If I add an empty string value, the rendering is as expected. This, ```html <div no-value=""></div> ``` renders as, ```html <div no-value></div> ``` I think the underlying call to `setAttribute()` should be a blank string if there is no value instead of `true`. Svelte repl [here](https://svelte.technology/repl?version=2.15.3&gist=064f8fea7ac8e7fc91bdaf78e223ec00). Inspecting the rendered output shows how without an attribute value, a value of "true" is rendered.
https://github.com/sveltejs/svelte/issues/1852
https://github.com/sveltejs/svelte/pull/1969
2d3dbdd6a97d395408d0ae1eed3d4495bcc7d09e
efa7ad64c153b497427b32381fa3c788c680412b
2018-11-16T17:30:44Z
javascript
2019-01-13T19:29:27Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,846
["site/content/guide/06-special-components.md", "src/compile/nodes/Body.ts", "src/compile/nodes/shared/mapChildren.ts", "src/compile/render-dom/wrappers/Body.ts", "src/compile/render-dom/wrappers/Fragment.ts", "src/compile/render-ssr/Renderer.ts", "src/parse/state/tag.ts", "test/parser/samples/error-svelte-selfdestructive/error.json", "test/runtime/samples/document-event/_config.js", "test/runtime/samples/document-event/main.html"]
document mouseenter/mouseleave not fired on Firefox
It seems that Firefox does not fire `mouseenter`/`mouseleave` events on the document, so the new `<svelte:document on:mouseenter/mouseleave>` does not work there. It looks like they are fired on `document.body`, and they are also fired there on Chrome. I know the whole point of `<svelte:document>` was to allow attaching these specific event handlers, but that's not cross-platform. The sanest thing might be to say 'ha, whoops, well don't use that' and to introduce a `<svelte:body>` that lets you attach handlers to the body. I'm not sure.
https://github.com/sveltejs/svelte/issues/1846
https://github.com/sveltejs/svelte/pull/1970
c8614f9ae9dd1e3fbc5c4da9db5a7c34b913a7a8
8e9f37a7d47a632b7aaa2b2a90c055519da20e23
2018-11-10T18:35:51Z
javascript
2019-01-09T19:46:21Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,837
["src/Stats.ts", "src/compile/index.ts", "test/stats/samples/props/_config.js", "test/stats/samples/props/input.html"]
Include expectedProperties in `stats`
My strategy for [v3](https://github.com/sveltejs/svelte/projects/3): Add a v3 command to [svelte-upgrade](https://github.com/sveltejs/svelte-upgrade), then use it to update all the tests so we don't have to do it manually. Side-benefit: it ensures we actually get around to making svelte-upgrade work for the 2-3 migration (to the extent possible, at least — I expect some unavoidable breakage). Once the tests are done, it'll be much easier to gradually implement the RFC. A key thing we need for svelte-upgrade is to be able to know which properties are expected by the component (either because they're referenced by computed properties, or they're referenced in the markup and are *not* computed properties). The plan: ```js const { ast, stats } = svelte.compile(` <h1>Hello {name}!</h1> <script> export default {...}; </script> `, { generate: false }); assert.deepEqual(stats.props, ['name']); ``` It's a shame we can't distinguish between props and state — we'll have to treat everything as a prop (i.e. add `export` for everything) for correctness. But that's just one of many ways in which v3 will be better than v2.
https://github.com/sveltejs/svelte/issues/1837
https://github.com/sveltejs/svelte/pull/1838
1f79099d2f6a542cceaa04b5916e63bee4a3b2c7
b6efae9b23522c8628e7deb4bae16b5089db8074
2018-11-04T21:07:05Z
javascript
2018-11-04T22:50:15Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,834
["src/compiler/compile/render_dom/wrappers/Element/StyleAttribute.ts", "src/runtime/internal/dom.ts", "test/runtime/samples/inline-style-important/_config.js", "test/runtime/samples/inline-style-important/main.svelte"]
inline !important styles don't get added
I'm using svelte 2.15.0 if my template has inline !important styles like `<div style="margin:10px !important"></div>` the compiler will create `setStyle(node, 'margin', '10px !important')` which in the end executes `node.style.setProperty('margin', '10px !important')` This fails silently and `margin` attribute doesn't get added, because `setProperty` expects !important attributes to be added with a flag like this: `node.style.setProperty('margin', '10px', 'important')`
https://github.com/sveltejs/svelte/issues/1834
https://github.com/sveltejs/svelte/pull/3435
38001cec334b7acfa36f83f6708ede1833cb647b
b567eb2677204f5b52d34ba57b59d56ba87ee413
2018-11-02T11:02:47Z
javascript
2019-08-22T12:52:26Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,830
["src/compiler/compile/render_dom/wrappers/Element/StyleAttribute.ts", "test/runtime/samples/inline-style-optimisation-bailout/_config.js", "test/runtime/samples/inline-style-optimisation-bailout/main.svelte"]
Setting inline styles with data elements breaks style
Here's a REPL demonstration: https://svelte.technology/repl?version=2.11.0&gist=02e988596c0d0888490384ec44d7f99c Putting a data variable into an inline style tag will try to concatenate your new `key:value;` with the preceding value. The result is that this text, which should be 0.25 opacity and yellow has no styles applied to it at all. ```html <h1 style="opacity: 0.25;{color}">Hello {name}!</h1> <script> export default { data () { return { color: 'color: #fc0;' } } } </script> ``` This is the generated JavaScript: ```js setStyle(h1, "opacity", "0.25" + ctx.color); ```
https://github.com/sveltejs/svelte/issues/1830
https://github.com/sveltejs/svelte/pull/3432
e5e41c7333e07d754ad55bed3391be71e3422782
63a7a37bb7c6820bda0a1716f52ec7eeb9b3711e
2018-10-30T22:27:25Z
javascript
2019-08-20T12:24:16Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,828
["src/compile/render-dom/index.ts", "src/compile/render-ssr/index.ts", "test/runtime/samples/dev-accept-declarative-store/_config.js", "test/runtime/samples/dev-accept-declarative-store/main.html", "test/runtime/samples/dev-error-missing-store-option/_config.js", "test/runtime/samples/dev-error-missing-store-option/main.html"]
2.15.0 throws incorrect error when using component-defined store
Before `2.15.0` this worked fine. https://svelte.technology/repl?version=2.14.3&gist=eb560c5e77f6768961e81c8b377c81ff In `2.15.0` it throws an error because the check doesn't work for the `store` property that a component can set itself. https://svelte.technology/repl?version=2.15.0&gist=eb560c5e77f6768961e81c8b377c81ff I'm certain this is fallout from https://github.com/sveltejs/svelte/pull/1811 but haven't dug in yet to see why it's broken.
https://github.com/sveltejs/svelte/issues/1828
https://github.com/sveltejs/svelte/pull/1829
03c7612c6beec3014886ae520e6822a2ff35e657
cb4a46d33ff4d73c80e132b61dee9e8927bfdf48
2018-10-30T16:53:03Z
javascript
2018-10-30T17:32:12Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,795
["src/compile/render-dom/wrappers/EachBlock.ts", "test/runtime/samples/each-block-index-only/_config.js", "test/runtime/samples/each-block-index-only/main.html"]
Old components not being removed when array changes
Haven't looked into this much yet, but if you click change a few times the old elements never get removed. https://svelte.technology/repl?version=2.14.2&gist=c55018f029a5a1bea95e81d403499f97
https://github.com/sveltejs/svelte/issues/1795
https://github.com/sveltejs/svelte/pull/1798
1e28b3f75830098a19d7e202a0094f17af34e296
e65b0bb2e33cb54c355ae6dcfc6c254b0e4f95bc
2018-10-24T03:59:15Z
javascript
2018-10-24T15:50:20Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,793
["src/compile/render-dom/wrappers/Element/index.ts", "src/compile/render-ssr/handlers/Element.ts", "test/runtime/samples/class-in-each/_config.js", "test/runtime/samples/class-in-each/main.html", "test/runtime/samples/event-handler-each-context/_config.js", "test/runtime/samples/event-handler-each-context/main.html"]
Data or Store references are not updated correctly inside directive
Consider the following example: ``` <ul> {#each plans as plan, idx} <li on:click="changePlan(idx)" class:selected="planIdx == idx">{plan.title}</li> {/each} </ul> <script> export default { data() { return { planIdx: 0, plans: [{ title: "Plan 1" }, { title: "Plan 2" }] }; }, methods: { changePlan(idx) { console.log("changing plan to", idx); this.set({planIdx: idx}); } } } </script> <style> .selected { font-weight: bold; } </style> ``` After clicking on `Plan2`, it should be highlighted, but it is not. Tested with `2.13.15` and `2.14.2`. The above example uses `data` but the same bug is found with `store` as well. If one of the data elements is part of the rendered HTML, then everything works fine. For example, if we change the HTML above to: ``` <li on:click="changePlan(idx)" class:selected="planIdx == idx">{plan.title} {planIdx}</li> ``` then everything works fine.
https://github.com/sveltejs/svelte/issues/1793
https://github.com/sveltejs/svelte/pull/1797
e65b0bb2e33cb54c355ae6dcfc6c254b0e4f95bc
d49f5f213635a2713d169332eaef4ebb6f723756
2018-10-23T18:00:18Z
javascript
2018-10-24T15:50:32Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,788
["src/parse/read/directives.ts"]
Parsing exceptions from Acorn for directives not correctly mapped to row/column
See e.g. https://svelte.technology/repl?version=2.14.0&gist=16755c91f5a1bb2bf2a587b1aa72e347 The error is displayed as being on line 1 column 80, when it is in fact at character 80. cc @TehShrike
https://github.com/sveltejs/svelte/issues/1788
https://github.com/sveltejs/svelte/pull/1789
c0ba6fb4ef190b79b9a6a805d1b591cbe9d5e908
9395573db58e275fff5ab31bdc7d729f21c522c3
2018-10-19T00:22:30Z
javascript
2018-10-20T12:51:34Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,778
["src/compile/render-dom/wrappers/Fragment.ts", "test/runtime/samples/if-block-first/_config.js", "test/runtime/samples/if-block-first/main.html"]
We lost anchor for add new block if {#if} clause first in element.
I suppose it's a very serious bug. https://svelte.technology/repl?version=2.14.0&gist=9e3d812ae74a6aa9b83923c7402a4977 at least now I found a workaround, I can add an empty <span> before {#if}.
https://github.com/sveltejs/svelte/issues/1778
https://github.com/sveltejs/svelte/pull/1790
0d797ea8aeba954d12a3921327d2c46c9d6be3c5
21ea87cd61fc551de4bfb97185f5990436d64619
2018-10-18T06:52:22Z
javascript
2018-10-19T04:07:34Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,774
["src/compile/render-dom/wrappers/Head.ts", "test/runtime/samples/head-if-block/_config.js", "test/runtime/samples/head-if-block/main.html"]
`#if` doesn't work inside `head`
See [repl](https://svelte.technology/repl?version=2.14.0&gist=abf510194d0192f4a3a58e389929f745). Worked pre 2.14.0.
https://github.com/sveltejs/svelte/issues/1774
https://github.com/sveltejs/svelte/pull/1775
9395573db58e275fff5ab31bdc7d729f21c522c3
635348a9196f09545d94334d70622a2cd2656857
2018-10-17T17:45:33Z
javascript
2018-10-20T12:52:41Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,772
["src/parse/index.ts", "src/parse/state/tag.ts", "test/parser/samples/attribute-containing-solidus/input.html", "test/parser/samples/attribute-containing-solidus/output.json"]
HTML5 attributes parsing
Svelte's attribute parser does not match html5 specs. As an example, this should work and properly validates, but svelte refuses to parse it: https://svelte.technology/repl?version=2.13.5&gist=890eadcdeaa2ac0130463565aa3ede4c This will most likely affect people using html minifiers before compiling their components.
https://github.com/sveltejs/svelte/issues/1772
https://github.com/sveltejs/svelte/pull/1776
635348a9196f09545d94334d70622a2cd2656857
9e899db21c131708f18aeebe02e4e2c0d23d1bc7
2018-10-16T06:17:48Z
javascript
2018-10-20T12:52:54Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,764
["CHANGELOG.md", "src/compiler/compile/render_dom/wrappers/Element/Binding.ts", "test/runtime/samples/binding-select-late-2/_config.js", "test/runtime/samples/binding-select-late-2/main.svelte"]
bind:value for keyed select tag doesn't work when options are updated
The selected value is known oncreate, but the `<option>` values are added later. The selected value isn't set when they are added. https://svelte.technology/repl?version=2.13.5&gist=17b698af0622793d4ab86ae62e275a51 Looks like it's related/similar to #1730 #1252 #1711
https://github.com/sveltejs/svelte/issues/1764
https://github.com/sveltejs/svelte/pull/4885
f624d6e292e6cf960200ba9ae42e3d5fdf7d7003
e34f2088434423914bbc91b84a450a7f7477252b
2018-10-02T18:17:30Z
javascript
2020-05-21T20:47:27Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,745
["src/compile/index.ts", "src/compile/wrapModule.ts", "src/index.ts", "src/interfaces.ts", "src/utils/deprecate.ts", "test/parser/index.js"]
Deprecate onerror
There's no value in a user-supplied `onerror` — it's not like `onwarn` where you can filter out warnings you don't want to deal with. An error is an error. The user should wrap `svelte.compile` in a try-catch block. I think we should noisily deprecate it, and remove it in v3.
https://github.com/sveltejs/svelte/issues/1745
https://github.com/sveltejs/svelte/pull/1759
540cd05d4284bafb7d280a10455a0c444dd50763
f1204bfad9ff13fa590c8222fa5d172d532831d8
2018-09-15T22:13:38Z
javascript
2018-10-17T15:31:09Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,743
["src/compile/render-dom/wrappers/Element/index.ts", "test/helpers.js", "test/js/samples/bind-width-height/expected.js", "test/runtime/samples/onupdate-after-concreate-using-bind-offsetWidth/_config.js", "test/runtime/samples/onupdate-after-concreate-using-bind-offsetWidth/main.html"]
onupdate fires before oncreate when using bind:offsetWidth etc.
[REPL](https://svelte.technology/repl?version=2.13.4&gist=38eab2a05548974f6970ec38cd8b8e4b) fires update, create, update. The first update fires with previous !== undefined. The order is correct when using onstate. Edit: Maybe related to [similar problem](https://github.com/sveltejs/svelte/issues/1483#issuecomment-412351139) with onstate that was fixed in 2.11
https://github.com/sveltejs/svelte/issues/1743
https://github.com/sveltejs/svelte/pull/1822
585abd96a5a566c34294f169fbafb41b945eeb60
79ea0bd43c8cb15b399255dbaa84833a94adb099
2018-09-15T17:26:42Z
javascript
2018-12-15T23:14:06Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,742
["src/compile/render-dom/wrappers/Element/Attribute.ts"]
Cannot specify `form=` attribute on form element
Specifying the `form=` attribute on form element results in code that attempts to set the `.form` property on the element, which throws an error as that is read-only. I'm not sure what the desired behavior here is. The immediately obvious path is to just not treat `form=` specially on form elements, and just generate `setAttribute` calls for this. But I don't know whether that's going to do the same thing as having a `form=` attribute on an element in regular old HTML.
https://github.com/sveltejs/svelte/issues/1742
https://github.com/sveltejs/svelte/pull/2670
ba91810b0b505bb120c30b2b884f5950ac574103
411752c5bb25d38d5ae57950ab4ac8d6ac4fca61
2018-09-15T14:18:54Z
javascript
2019-05-04T15:27:21Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,739
["src/compile/nodes/Element.ts", "test/runtime/samples/class-shortcut-with-class/_config.js", "test/runtime/samples/class-shortcut-with-class/main.html", "test/runtime/samples/class-shortcut/_config.js", "test/runtime/samples/class-shortcut/main.html"]
class shorthand directive with computed (or any?) property doesn't update properly
Demo: https://svelte.technology/repl?version=2.13.4&gist=c701a8c8404a63e379818995093f6117 Run `app.set({bar: true})` and watch absolutely nothing happen to the h1. If you change the directive to `class:foo="foo"`, it works fine. Edit: It appears to happen with all properties, not just computed. No idea why I didn't see it with non-computed before.
https://github.com/sveltejs/svelte/issues/1739
https://github.com/sveltejs/svelte/pull/1749
0d10d6cc2d6c7c5c901cece0882e3a7cd3436df9
d219da3ded2585087af558d5360ec44ec8db428d
2018-09-13T06:35:35Z
javascript
2018-09-19T21:30:28Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,733
["CHANGELOG.md", "src/runtime/internal/dom.ts", "test/hydration/samples/element-attribute-removed/_before.html"]
Hydrating element removes every other attribute
I'm new to Svelte so it's entirely possible i'm missing something basic. I'm seeing some weird behavior around the hydration feature. Attributes on the element being hydrated are removed and I'm not sure why. For example, given this markup: ```html <span id="rehydrateContainer"> <button data-track-id="123" class="button button--small" id="button" role="button" disabled>content</button> </span> ``` and this component: ```html <button on:click="set({ count: count + 1 })"> {text} {count} </button> <script> export default { oncreate() { this.set({ count: 0 }); } }; </script> ``` the hydrated dom ends up being this: ```html <span id="rehydrateContainer"> <button class="button button--small" role="button">rehydrated 0</button> </span> ``` At first glance it seems that it maybe only works with certain attributes like `class` or `role` but that's not the case. When I change the order it seems like the odd numbered attributes are being removed. given this: ```html <button class="button button--small" data-track-id="123" role="button" id="button" disabled>content</button> ``` we end up with this: ```html <button data-track-id="123" id="button">rehydrated 0</button> ``` here's a small reproduction to play around with: https://github.com/sammynave/rehydrate-attrs
https://github.com/sveltejs/svelte/issues/1733
https://github.com/sveltejs/svelte/pull/4288
e4460e38ba58d5209514f0fa93dc61b6bb1ebb54
92692128441849fbb35e17456549783eafa7b0e8
2018-09-12T14:38:41Z
javascript
2020-01-20T15:46:29Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,732
["src/compile/nodes/Element.ts", "test/runtime/samples/binding-input-checkbox-with-event-in-each/_config.js", "test/runtime/samples/binding-input-checkbox-with-event-in-each/main.html"]
bind:checked plus on:change resurrect the old list aftrer modification
Subj. It's difficult to explain just try the example: https://svelte.technology/repl?version=2.13.4&gist=f6782626b2265bf3eeb0adbe501156a6
https://github.com/sveltejs/svelte/issues/1732
https://github.com/sveltejs/svelte/pull/1737
a4d412fb537aee6d655a819fbc199594ca95e916
d7bd924bbdca58570444fc4697bdf94d5d3b29f8
2018-09-12T09:15:28Z
javascript
2018-09-13T04:33:51Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,716
["src/compile/nodes/CatchBlock.ts", "src/compile/nodes/PendingBlock.ts", "src/compile/nodes/ThenBlock.ts", "src/parse/state/mustache.ts", "test/parser/samples/await-then-catch/output.json", "test/validator/samples/await-no-catch/input.svelte", "test/validator/samples/await-no-catch/warnings.json", "test/validator/samples/await-shorthand-no-catch/input.svelte", "test/validator/samples/await-shorthand-no-catch/warnings.json"]
Erroneous empty block warnings for compact await blocks
[REPL](https://svelte.technology/repl?version=2.13.4&gist=8c6d7a09e6d8b5d6919294f10ca6cb6f)
https://github.com/sveltejs/svelte/issues/1716
https://github.com/sveltejs/svelte/pull/2596
d3d5fa936018d419711ad9efef69701921ee4ce8
006509a0ef50453d7b4cc4ec52958f54625fb1f1
2018-09-06T20:36:03Z
javascript
2019-05-04T15:05:30Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,710
["CHANGELOG.md", "src/compiler/compile/css/Selector.ts", "test/css/samples/weird-selectors/expected.css", "test/css/samples/weird-selectors/input.svelte"]
CSS classes starting with `-` is always unused and `--` throws
CSS allow classes starting with `-`, but the svelte compiler flags them as unused [REPL](https://svelte.technology/repl?version=2.13.2&gist=f146227d9270080eea32d537a70376a8) With double `--` it's even worse [REPL](https://svelte.technology/repl?version=2.13.2&gist=1e3dc7df3352f78a0b0645f18c511503)
https://github.com/sveltejs/svelte/issues/1710
https://github.com/sveltejs/svelte/pull/3552
3c6bb880d7fcecd2ce463eb55dcde967b735ed4f
3c5ccf6ee59a39b1821ea057ffc80cccf9a39f43
2018-08-31T17:12:41Z
javascript
2019-09-16T23:35:41Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,706
["src/compile/nodes/EachBlock.ts", "test/runtime/samples/transition-js-nested-each-keyed-2/Widget.html", "test/runtime/samples/transition-js-nested-each-keyed-2/_config.js", "test/runtime/samples/transition-js-nested-each-keyed-2/main.html"]
Keyed feature broken with dynamic component
If you'll try to switch page - nothing will happens, but if remove keyed feature from each-block, everything works fine. https://svelte.technology/repl?version=2.13.2&gist=2a42422d03a9e136c96446aa9ddd788a
https://github.com/sveltejs/svelte/issues/1706
https://github.com/sveltejs/svelte/pull/1709
2e4b65af5ae4d762607a53c0c8cdaf24c58a0837
67d4d60c3ab1ecce0467a06b8075f508dd8c01eb
2018-08-29T10:49:20Z
javascript
2018-09-06T01:04:07Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,705
["src/compiler/compile/css/Selector.ts", "test/css/samples/not-selector/expected.css", "test/css/samples/not-selector/input.svelte"]
:not(...) styles are broken
[REPL](https://svelte.technology/repl?version=2.13.1&gist=c80e2cda5f07897ad9eaada7df570cc0). The encapsulator should treat `:not(selector)` as `*:not(selector)`, but it doesn't.
https://github.com/sveltejs/svelte/issues/1705
https://github.com/sveltejs/svelte/pull/3141
220515b60572cae18e85ef19e63bd2ca04fd8806
4b62fa27e49f9a6fa2eb97125201519459919d99
2018-08-28T19:32:50Z
javascript
2019-07-01T15:26:10Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,704
["src/compile/Component.ts", "src/compile/nodes/shared/Expression.ts", "test/validator/samples/method-nonexistent-helper/warnings.json", "test/validator/samples/unused-helper.skip/warnings.json", "test/validator/samples/unused-helper/input.html", "test/validator/samples/unused-helper/warnings.json"]
Warn on unused helpers
Currently you don't get any feedback if you do [this](https://svelte.technology/repl?version=2.13.1&gist=0e203f9888faba5f61c5f5839117cabe): ```html <h1>Hello {name}!</h1> <script> export default { helpers: { unused(a) { return a * 2; } } }; </script> ```
https://github.com/sveltejs/svelte/issues/1704
https://github.com/sveltejs/svelte/pull/1744
9031c1690588f7dfe6633b876d025814d94ad6c9
0d10d6cc2d6c7c5c901cece0882e3a7cd3436df9
2018-08-28T17:22:52Z
javascript
2018-09-15T22:05:00Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,701
["src/runtime/internal/dom.ts", "test/runtime/samples/binding-input-number/_config.js"]
For input numbers we should use null instead undefined in toNumber
If you return undefined it became the problem for some situations like this (we can't set undefined back): https://svelte.technology/repl?version=2.30.1&gist=4728f0fd73979c92e7c07ec0a7eebb94 by the standard, the "number input" can contain numbers or empty and empty here is an empty string or null. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/number
https://github.com/sveltejs/svelte/issues/1701
https://github.com/sveltejs/svelte/pull/4772
d201c5bfb3388259ffc3bb7f5cb717aa43293015
4b59491ea4db972e45b7eff679e73db5857c0006
2018-08-28T06:41:23Z
javascript
2020-09-10T19:49:57Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,699
["src/compile/nodes/Binding.ts", "test/js/samples/input-files/expected-bundle.js", "test/js/samples/input-files/expected.js", "test/js/samples/input-range/expected-bundle.js", "test/js/samples/input-range/expected.js", "test/js/samples/input-without-blowback-guard/expected-bundle.js", "test/js/samples/input-without-blowback-guard/expected.js", "test/js/samples/media-bindings/expected-bundle.js", "test/js/samples/media-bindings/expected.js"]
A weird input selection bug in Safari
[REPL reproduction](https://svelte.technology/repl?version=2.13.1&gist=6117dbe9c6177c077d8ea9e12393955c) In Safari (not Chrome or Firefox), whenever `set` is called, the selection in the focused input is reset, even if the value you're `set`ting is unrelated to the input.
https://github.com/sveltejs/svelte/issues/1699
https://github.com/sveltejs/svelte/pull/1703
63276479497a2255c8cc8be535455a0366164700
3c9d4b2862b0811dada00d8e3c70eab735a20873
2018-08-27T22:09:30Z
javascript
2018-08-28T19:07:03Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,676
["src/parse/read/directives.ts", "test/runtime/samples/action-ternary-template/_config.js", "test/runtime/samples/action-ternary-template/main.html"]
Actions should be able to accept template strings as arguments.
https://svelte.technology/repl?version=2.9.5&gist=ad939c33265c86335cdb70f84c5eee41 Currently you cannot pass template strings to actions. This makes some use cases rather annoying to implement. ie: iterating over a list and passing data as a string. Thanks!
https://github.com/sveltejs/svelte/issues/1676
https://github.com/sveltejs/svelte/pull/1679
f38bdaaadf7e10c2a6bdaf5f802fef26e796803a
e450c3094371161495d0dcb84b777438a4f3e687
2018-08-22T21:23:13Z
javascript
2018-08-24T00:51:03Z