Subscribe on changes!

Teleported content is duplicated if a text interpolated value is updated and v-ifed in and out of the DOM

avatar
Nov 12th 2021

Version

3.2.21

Reproduction link

sfc.vuejs.org/

Steps to reproduce

  1. Click the button labeled 'Toggle'
  2. Click the button labeled 'Update'
  3. Click the button labeled 'Toggle'
  4. Click the button labeled 'Toggle'
  5. Click the button labeled 'Update'
  6. Click the button labeled 'Toggle'
  7. Click the button labeled 'Toggle'

Notice that the teleported text is duplicated. Repeating the steps above will append the content with more duplicated text.

What is expected?

Teleported content can be shown and hidden without duplication

What is actually happening?

Teleported content is duplicated


I was attempting to use teleport to create a modal and found that teleported content was being duplicated as I was routing throughout the application, although routing is not required to reproduce the issue as demonstrated in the minimal reproduction link.

avatar
Nov 14th 2021

as a workaround

      <teleport to="body">
        <span key="1">
            This text is teleported and will be duplicated.
        </span>
      </teleport>

maybe should force bail out of optimize mode image

avatar
Oct 19th 2022

I have a similar Issue. @mmrpm the repro you provided doesn't work anymore (throws Errors) @edison1105 This is a workaround inside of vuejs core, correct? => not a workaround that one can use in a normal Vue Project, correct?

avatar
Oct 20th 2022

@telion2 could you create a new issue with a minimal repro?