File tree 3 files changed +41
-7
lines changed
src/compiler/compile/render_dom
test/runtime/samples/props-reactive-b
3 files changed +41
-7
lines changed Original file line number Diff line number Diff line change @@ -359,15 +359,11 @@ export default function dom(
359
359
360
360
component . reactive_declarations
361
361
. forEach ( d => {
362
- let uses_props ;
362
+ const dependencies = Array . from ( d . dependencies ) ;
363
+ const uses_props = ! ! dependencies . find ( n => n === '$$props' ) ;
363
364
364
- const condition = Array . from ( d . dependencies )
365
+ const condition = ! uses_props && dependencies
365
366
. filter ( n => {
366
- if ( n === '$$props' ) {
367
- uses_props = true ;
368
- return false ;
369
- }
370
-
371
367
const variable = component . var_lookup . get ( n ) ;
372
368
return variable && ( variable . writable || variable . mutated ) ;
373
369
} )
Original file line number Diff line number Diff line change
1
+ export default {
2
+ props : {
3
+ a : 1 ,
4
+ b : 2
5
+ } ,
6
+
7
+ html : `
8
+ <p>a: 1</p>
9
+ <p>b: 2</p>
10
+ <p>c: 3</p>
11
+ ` ,
12
+
13
+ async test ( { assert, component, target } ) {
14
+ await component . $set ( { a : 4 } ) ;
15
+
16
+ assert . htmlEqual ( target . innerHTML , `
17
+ <p>a: 4</p>
18
+ <p>b: 2</p>
19
+ <p>c: 6</p>
20
+ ` ) ;
21
+
22
+ await component . $set ( { b : 5 } ) ;
23
+
24
+ assert . htmlEqual ( target . innerHTML , `
25
+ <p>a: 4</p>
26
+ <p>b: 5</p>
27
+ <p>c: 9</p>
28
+ ` ) ;
29
+ }
30
+ } ;
Original file line number Diff line number Diff line change
1
+ <script >
2
+ export let a;
3
+ $: c = a + $$props .b ;
4
+ </script >
5
+
6
+ <p >a: {a }</p >
7
+ <p >b: {$$props .b }</p >
8
+ <p >c: {c }</p >
You can’t perform that action at this time.
0 commit comments