File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed
packages/svelte/src/reactivity Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change 1
1
/** @import { Source } from '#client' */
2
+ import { DEV } from 'esm-env' ;
2
3
import { set , source } from '../internal/client/reactivity/sources.js' ;
3
4
import { get } from '../internal/client/runtime.js' ;
4
5
import { increment } from './utils.js' ;
@@ -20,6 +21,9 @@ export class SvelteMap extends Map {
20
21
constructor ( value ) {
21
22
super ( ) ;
22
23
24
+ // If the value is invalid then the native exception will fire here
25
+ if ( DEV ) value = new Map ( value ) ;
26
+
23
27
if ( value ) {
24
28
for ( var [ key , v ] of value ) {
25
29
super . set ( key , v ) ;
Original file line number Diff line number Diff line change 1
1
/** @import { Source } from '#client' */
2
+ import { DEV } from 'esm-env' ;
2
3
import { source , set } from '../internal/client/reactivity/sources.js' ;
3
4
import { get } from '../internal/client/runtime.js' ;
4
5
import { increment } from './utils.js' ;
@@ -24,6 +25,10 @@ export class SvelteSet extends Set {
24
25
constructor ( value ) {
25
26
super ( ) ;
26
27
28
+ // If the value is invalid then the native exception will fire here
29
+ // @ts -ignore
30
+ if ( DEV ) value = new Set ( Array . from ( value ) ) ;
31
+
27
32
if ( value ) {
28
33
for ( let element of value ) {
29
34
super . add ( element ) ;
You can’t perform that action at this time.
0 commit comments