fix: ensure SvelteMap and SvelteSet work with generators in dev (#14103)

* fix: ensure SvelteMap and SvelteSet work with generators in dev

* add test

* better fix

* better fix

* better fix

* better fix
pull/14105/head
Dominic Gannaway 4 days ago committed by GitHub
parent 535ea44b9d
commit 9883e7078c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: ensure SvelteMap and SvelteSet work with generators in dev

@ -22,7 +22,7 @@ export class SvelteMap extends Map {
super();
// If the value is invalid then the native exception will fire here
if (DEV) new Map(value);
if (DEV) value = new Map(value);
if (value) {
for (var [key, v] of value) {

@ -26,7 +26,7 @@ export class SvelteSet extends Set {
super();
// If the value is invalid then the native exception will fire here
if (DEV) new Set(value);
if (DEV) value = new Set(value);
if (value) {
for (var element of value) {

@ -0,0 +1,9 @@
import { test } from '../../test';
export default test({
compileOptions: {
dev: true
},
html: `1`
});

@ -0,0 +1,14 @@
<script>
import { SvelteSet } from 'svelte/reactivity';
function *generator() {
yield 1;
}
let gen = new SvelteSet(generator());
</script>
{#each gen as item}
{item}
{/each}
Loading…
Cancel
Save