File tree Expand file tree Collapse file tree 5 files changed +57
-3
lines changed
tests/runtime-runes/samples/non-local-mutation-ok Expand file tree Collapse file tree 5 files changed +57
-3
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' svelte ' : patch
3+ ---
4+
5+ fix: ignore mutation validation for props that are not proxies in more cases
Original file line number Diff line number Diff line change @@ -31,13 +31,14 @@ export function create_ownership_validator(props) {
3131 return result ;
3232 }
3333
34- let value = props [ name ] ;
34+ /** @type {any } */
35+ let value = props ;
3536
36- for ( let i = 1 ; i < path . length - 1 ; i ++ ) {
37+ for ( let i = 0 ; i < path . length - 1 ; i ++ ) {
38+ value = value [ path [ i ] ] ;
3739 if ( ! value ?. [ STATE_SYMBOL ] ) {
3840 return result ;
3941 }
40- value = value [ path [ i ] ] ;
4142 }
4243
4344 const location = sanitize_location ( `${ component [ FILENAME ] } :${ line } :${ column } ` ) ;
Original file line number Diff line number Diff line change 1+ import { flushSync } from 'svelte' ;
2+ import { test } from '../../test' ;
3+
4+ export default test ( {
5+ solo : true ,
6+ compileOptions : {
7+ dev : true
8+ } ,
9+
10+ test ( { assert, target, warnings } ) {
11+ const btn = target . querySelector ( 'button' ) ;
12+ btn ?. click ( ) ;
13+ flushSync ( ) ;
14+
15+ assert . deepEqual ( warnings , [ ] ) ;
16+ } ,
17+
18+ warnings : [ ]
19+ } ) ;
Original file line number Diff line number Diff line change 1+ <script >
2+ let { klass, getter_setter } = $props ();
3+ </script >
4+
5+ <button onclick ={() => {
6+ klass .y = 2 ;
7+ getter_setter .y = 2 ;
8+ }}>mutate</button >
Original file line number Diff line number Diff line change 1+ <script >
2+ import Child from ' ./child.svelte' ;
3+
4+ class X {
5+ y = $state (1 );
6+ }
7+
8+ const klass = new X ();
9+
10+ let y = $state (1 );
11+ const getter_setter = {
12+ get y () {
13+ return y;
14+ },
15+ set y (value ) {
16+ y = value;
17+ }
18+ }
19+ </script >
20+
21+ <Child {klass } {getter_setter } />
You can’t perform that action at this time.
0 commit comments