@@ -8,7 +8,7 @@ import { children } from './ish.js';
88import { effect } from './signals.js' ;
99import { isArray } from '../utils.js' ;
1010import { PersistentFragment , diffFragment , nodes } from './persistent-fragment.js' ;
11- import { ARRAY , COMMENT , COMPONENT , EVENT , KEY , REF , ref } from './update.js' ;
11+ import { ARRAY , COMMENT , COMPONENT , EVENT , KEY , REF , SIGNAL , ref } from './update.js' ;
1212
1313import { _get as getDirect , _set as setDirect } from './direct.js' ;
1414import { Signal , _get as getSignal , _set as setSignal } from './signals.js' ;
@@ -146,7 +146,7 @@ export class Hole {
146146 let commit = true ;
147147 //@ts -ignore
148148 if ( DEBUG && ( type & ARRAY ) && ! isArray ( value ) ) throw errors . invalid_interpolation ( this . t [ 3 ] , value ) ;
149- if ( ! direct && ( type & COMMENT ) ) {
149+ if ( ! direct && ( type & COMMENT ) && ! ( type & SIGNAL ) ) {
150150 if ( type & ARRAY ) {
151151 commit = false ;
152152 //@ts -ignore
@@ -172,7 +172,7 @@ export class Hole {
172172 }
173173 //@ts -ignore
174174 changes [ length ] = [ type , update , value , node ] ;
175- if ( direct && type === COMMENT ) node . remove ( ) ;
175+ if ( direct && ( type & COMMENT ) ) node . remove ( ) ;
176176 }
177177 }
178178 if ( refs ) {
@@ -236,15 +236,7 @@ export class Hole {
236236 }
237237 else {
238238 let change = value ;
239- if ( type === COMMENT ) {
240- if ( prev instanceof Hole ) {
241- if ( DEBUG && ! ( value instanceof Hole ) ) throw errors . invalid_interpolation ( [ ] , value ) ;
242- value = getHole ( prev , /** @type {Hole } */ ( value ) ) ;
243- //@ts -ignore
244- change = value . n ;
245- }
246- }
247- else if ( type & ARRAY ) {
239+ if ( type & ARRAY ) {
248240 if ( DEBUG && ! isArray ( value ) ) throw errors . invalid_interpolation ( [ ] , value ) ;
249241 if ( type & COMMENT ) {
250242 //@ts -ignore
@@ -268,6 +260,20 @@ export class Hole {
268260 //@ts -ignore
269261 else if ( ( type & EVENT ) && ( value [ 0 ] === prev [ 0 ] ) ) continue ;
270262 }
263+ else if ( type & COMMENT ) {
264+ if ( type & SIGNAL ) {
265+ if ( value === prev ) {
266+ update ( entry [ 3 ] , change ) ;
267+ continue ;
268+ }
269+ }
270+ else if ( prev instanceof Hole ) {
271+ if ( DEBUG && ! ( value instanceof Hole ) ) throw errors . invalid_interpolation ( [ ] , value ) ;
272+ value = getHole ( prev , /** @type {Hole } */ ( value ) ) ;
273+ //@ts -ignore
274+ change = value . n ;
275+ }
276+ }
271277 if ( value !== prev ) {
272278 entry [ 2 ] = value ;
273279 update ( entry [ 3 ] , change ) ;
0 commit comments