File tree Expand file tree Collapse file tree 3 files changed +36
-5
lines changed
src/compiler/phases/3-transform/client/visitors
tests/runtime-runes/samples/debug-tag-object Expand file tree Collapse file tree 3 files changed +36
-5
lines changed Original file line number Diff line number Diff line change @@ -9,13 +9,15 @@ import * as b from '../../../../utils/builders.js';
99 */
1010export function DebugTag ( node , context ) {
1111 const object = b . object (
12- node . identifiers . map ( ( identifier ) =>
13- b . prop (
12+ node . identifiers . map ( ( identifier ) => {
13+ const visited = b . call ( '$.snapshot' , /** @type {Expression } */ ( context . visit ( identifier ) ) ) ;
14+
15+ return b . prop (
1416 'init' ,
1517 identifier ,
16- b . call ( '$.snapshot ' , /** @type { Expression } */ ( context . visit ( identifier ) ) )
17- )
18- )
18+ context . state . analysis . runes ? visited : b . call ( '$.untrack ' , b . thunk ( visited ) )
19+ ) ;
20+ } )
1921 ) ;
2022
2123 const call = b . call ( 'console.log' , object ) ;
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+ compileOptions : {
6+ dev : true
7+ } ,
8+
9+ test ( { assert, target, logs } ) {
10+ const b1 = target . querySelector ( 'button' ) ;
11+ b1 ?. click ( ) ;
12+ flushSync ( ) ;
13+ b1 ?. click ( ) ;
14+ flushSync ( ) ;
15+
16+ assert . deepEqual ( logs , [
17+ { count : { current : 0 } } ,
18+ { count : { current : 1 } } ,
19+ { count : { current : 2 } }
20+ ] ) ;
21+ }
22+ } ) ;
Original file line number Diff line number Diff line change 1+ <script >
2+ let count = $state ({ current: 0 });
3+ </script >
4+
5+ {@debug count }
6+
7+ <button onclick ={()=> count .current ++ }>+</button >
You can’t perform that action at this time.
0 commit comments