@@ -264,7 +264,7 @@ export default class IfBlockWrapper extends Wrapper {
264
264
block . builders . init . add_block ( deindent `
265
265
function ${ select_block_type } (changed, ctx) {
266
266
${ this . branches . map ( ( { condition, snippet, block } ) => condition
267
- ? `if (${ snippet } ) return ${ block . name } ;`
267
+ ? `if (${ snippet || condition } ) return ${ block . name } ;`
268
268
: `return ${ block . name } ;` ) }
269
269
}
270
270
` ) ;
@@ -340,32 +340,6 @@ export default class IfBlockWrapper extends Wrapper {
340
340
block . add_variable ( current_block_type_index ) ;
341
341
block . add_variable ( name ) ;
342
342
343
- /* eslint-disable @typescript-eslint/indent,indent */
344
- if ( this . needs_update ) {
345
- block . builders . init . add_block ( deindent `
346
- function ${ select_block_type } (changed, ctx) {
347
- ${ this . branches . map ( ( { dependencies, condition, snippet, block } ) => condition
348
- ? deindent `
349
- ${ snippet && (
350
- dependencies . length > 0
351
- ? `if ((${ condition } == null) || ${ dependencies . map ( n => `changed.${ n } ` ) . join ( ' || ' ) } ) ${ condition } = !!(${ snippet } )`
352
- : `if (${ condition } == null) ${ condition } = !!(${ snippet } )`
353
- ) }
354
- if (${ condition } ) return ${ block . name } ;`
355
- : `return ${ block . name } ;` ) }
356
- }
357
- ` ) ;
358
- } else {
359
- block . builders . init . add_block ( deindent `
360
- function ${ select_block_type } (changed, ctx) {
361
- ${ this . branches . map ( ( { condition, snippet, block } ) => condition
362
- ? `if (${ snippet } ) return ${ block . name } ;`
363
- : `return ${ block . name } ;` ) }
364
- }
365
- ` ) ;
366
- }
367
- /* eslint-enable @typescript-eslint/indent,indent */
368
-
369
343
/* eslint-disable @typescript-eslint/indent,indent */
370
344
block . builders . init . add_block ( deindent `
371
345
var ${ if_block_creators } = [
@@ -388,7 +362,7 @@ export default class IfBlockWrapper extends Wrapper {
388
362
: deindent `
389
363
function ${ select_block_type } (changed, ctx) {
390
364
${ this . branches . map ( ( { condition, snippet } , i ) => condition
391
- ? `if (${ snippet } ) return ${ String ( i ) } ;`
365
+ ? `if (${ snippet || condition } ) return ${ String ( i ) } ;`
392
366
: `return ${ i } ;` ) }
393
367
${ ! has_else && `return -1;` }
394
368
}
0 commit comments