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 11/** @import { Source } from '#client' */
2+ import { DEV } from 'esm-env' ;
23import { set , source } from '../internal/client/reactivity/sources.js' ;
34import { get } from '../internal/client/runtime.js' ;
45import { increment } from './utils.js' ;
@@ -20,6 +21,9 @@ export class SvelteMap extends Map {
2021 constructor ( value ) {
2122 super ( ) ;
2223
24+ // If the value is invalid then the native exception will fire here
25+ if ( DEV ) value = new Map ( value ) ;
26+
2327 if ( value ) {
2428 for ( var [ key , v ] of value ) {
2529 super . set ( key , v ) ;
Original file line number Diff line number Diff line change 11/** @import { Source } from '#client' */
2+ import { DEV } from 'esm-env' ;
23import { source , set } from '../internal/client/reactivity/sources.js' ;
34import { get } from '../internal/client/runtime.js' ;
45import { increment } from './utils.js' ;
@@ -24,6 +25,10 @@ export class SvelteSet extends Set {
2425 constructor ( value ) {
2526 super ( ) ;
2627
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+
2732 if ( value ) {
2833 for ( let element of value ) {
2934 super . add ( element ) ;
You can’t perform that action at this time.
0 commit comments