diff --git a/src/generators/dom/visitors/IfBlock.ts b/src/generators/dom/visitors/IfBlock.ts index e7fecebefe..fc2c54ca97 100644 --- a/src/generators/dom/visitors/IfBlock.ts +++ b/src/generators/dom/visitors/IfBlock.ts @@ -369,8 +369,11 @@ function compoundWithOutros( `; const createNewBlock = deindent` - ${name} = ${if_blocks}[ ${current_block_index} ] = ${if_block_creators}[ ${current_block_index} ]( ${params}, ${block.component} ); - ${name}.create(); + ${name} = ${if_blocks}[ ${current_block_index} ]; + if ( !${name} ) { + ${name} = ${if_blocks}[ ${current_block_index} ] = ${if_block_creators}[ ${current_block_index} ]( ${params}, ${block.component} ); + ${name}.create(); + } ${name}.${mountOrIntro}( ${parentNode}, ${anchor} ); `; diff --git a/test/runtime/samples/transition-js-if-block-in-each-block-bidi-3/_config.js b/test/runtime/samples/transition-js-if-block-in-each-block-bidi-3/_config.js new file mode 100644 index 0000000000..bcb5a9e05f --- /dev/null +++ b/test/runtime/samples/transition-js-if-block-in-each-block-bidi-3/_config.js @@ -0,0 +1,37 @@ +export default { + data: { + foo: false, + threshold: 5 + }, + + html: ` +