@@ -479,7 +479,15 @@ export default class extends Module {
479479 const actual = structuredClone ( space . children [ id ] ?. content ) ;
480480 if ( ! include ) return actual && ( await this . removeFromSpace ( space , child ) ) ;
481481
482- const expected = { order, suggested } ;
482+ // TODO I just put [] here to get TypeScript to shut the fuck up about expected's type when we assign to via below
483+ // (And then I *still* had to cast it away from never[]... there's gotta be a better way??)
484+ const expected = { order, suggested, via : [ ] as string [ ] } ;
485+
486+ // `via` MUST have at least one value or the child is not considered part of the space,
487+ // but room v12 changes the ID format that this split relies on.
488+ // TODO is there any reason to not *always* just use this.plan.homeserver?
489+ const via = [ id . split ( ":" , 2 ) [ 1 ] ?? this . plan . homeserver ] ;
490+ expected . via = via ;
483491
484492 if ( actual ) {
485493 let changed = false ;
@@ -501,12 +509,8 @@ export default class extends Module {
501509 await space . addChildRoom ( id , actual ) ;
502510 }
503511 } else {
504- // `via` MUST have at least one value or the child is not considered part of the space,
505- // but room v12 changes the ID format that this split relies on.
506- // TODO is there any reason to not *always* just use this.plan.homeserver?
507- const via = [ id . split ( ":" , 2 ) [ 1 ] ?? this . plan . homeserver ] ;
508512 this . info ( "🏘️ Add to space" , { space : space . room . local , child : local , via } ) ;
509- await space . addChildRoom ( id , { via , ... expected } ) ;
513+ await space . addChildRoom ( id , expected ) ;
510514 }
511515 if ( space . room . private ) this . #publicSpaceByChild. delete ( id ) ;
512516 else if ( ! this . #publicSpaceByChild. has ( id ) )
0 commit comments