@@ -268,6 +268,21 @@ export default class InlineComponentWrapper extends Wrapper {
268
268
` ) ;
269
269
if ( all_dependencies . size ) {
270
270
const condition = renderer . dirty ( Array . from ( all_dependencies ) ) ;
271
+ if ( this . node . name === 'svelte:component' ) {
272
+ // statements will become switch_props function body
273
+ // rewrite last statement, add props update logic
274
+ statements [ statements . length - 1 ] = b `
275
+ if (#dirty !== undefined && ${ condition } ) {
276
+ ${ props } = @get_spread_update(${ levels } , [
277
+ ${ changes }
278
+ ]);
279
+ } else {
280
+ for (let #i = 0; #i < ${ levels } .length; #i += 1) {
281
+ ${ props } = @assign(${ props } , ${ levels } [#i]);
282
+ }
283
+ }
284
+ ` ;
285
+ }
271
286
updates . push ( b `
272
287
const ${ name_changes } = ${ condition } ? @get_spread_update(${ levels } , [
273
288
${ changes }
@@ -396,7 +411,7 @@ export default class InlineComponentWrapper extends Wrapper {
396
411
block . chunks . init . push ( b `
397
412
var ${ switch_value } = ${ snippet } ;
398
413
399
- function ${ switch_props } (#ctx) {
414
+ function ${ switch_props } (#ctx, #dirty ) {
400
415
${
401
416
( this . node . attributes . length > 0 || this . node . bindings . length > 0 ) &&
402
417
b `
@@ -464,7 +479,7 @@ export default class InlineComponentWrapper extends Wrapper {
464
479
465
480
if (${ switch_value } ) {
466
481
${ update_insert }
467
- ${ name } = @construct_svelte_component(${ switch_value } , ${ switch_props } (#ctx));
482
+ ${ name } = @construct_svelte_component(${ switch_value } , ${ switch_props } (#ctx, #dirty ));
468
483
469
484
${ munged_bindings }
470
485
${ munged_handlers }
0 commit comments