11/** @import { ComponentConstructorOptions, ComponentType, SvelteComponent, Component } from 'svelte' */
2- import { DIRTY , MAYBE_DIRTY } from '../internal/client/constants.js' ;
2+ import { DIRTY , LEGACY_PROPS , MAYBE_DIRTY } from '../internal/client/constants.js' ;
33import { user_pre_effect } from '../internal/client/reactivity/effects.js' ;
44import { mutable_source , set } from '../internal/client/reactivity/sources.js' ;
55import { hydrate , mount , unmount } from '../internal/client/render.js' ;
@@ -89,7 +89,7 @@ class Svelte4Component {
8989 } ;
9090
9191 // Replicate coarse-grained props through a proxy that has a version source for
92- // each property, which is increment on updates to the property itself. Do not
92+ // each property, which is incremented on updates to the property itself. Do not
9393 // use our $state proxy because that one has fine-grained reactivity.
9494 const props = new Proxy (
9595 { ...( options . props || { } ) , $$events : { } } ,
@@ -98,26 +98,15 @@ class Svelte4Component {
9898 return get ( sources . get ( prop ) ?? add_source ( prop , Reflect . get ( target , prop ) ) ) ;
9999 } ,
100100 has ( target , prop ) {
101+ // Necessary to not throw "invalid binding" validation errors on the component side
102+ if ( prop === LEGACY_PROPS ) return true ;
103+
101104 get ( sources . get ( prop ) ?? add_source ( prop , Reflect . get ( target , prop ) ) ) ;
102105 return Reflect . has ( target , prop ) ;
103106 } ,
104107 set ( target , prop , value ) {
105108 set ( sources . get ( prop ) ?? add_source ( prop , value ) , value ) ;
106109 return Reflect . set ( target , prop , value ) ;
107- } ,
108- getOwnPropertyDescriptor ( target , prop ) {
109- // TODO this throws "invalid binding" errors on the component side
110- const desc = Reflect . getOwnPropertyDescriptor ( target , prop ) ;
111- if ( ! desc ?. configurable ) return desc ;
112- return {
113- get : ( ) => get ( sources . get ( prop ) ?? add_source ( prop , Reflect . get ( target , prop ) ) ) ,
114- set : ( value ) => {
115- set ( sources . get ( prop ) ?? add_source ( prop , value ) , value ) ;
116- return Reflect . set ( target , prop , value ) ;
117- } ,
118- enumerable : desc . enumerable ,
119- configurable : desc . configurable
120- } ;
121110 }
122111 }
123112 ) ;
0 commit comments