Skip to content

v-once on template not working inside a v-for in two cases #10906

@posva

Description

@posva
Member

Version

2.6.10

Reproduction link

https://codepen.io/xiangyuecn/pen/eYmmPNP

moved from #10892

Steps to reproduce

The repro adds entries to an array, causing a re render that. The template intentionally displays the elapsed time to see which v-once work and which do not

What is expected?

All v-once to never render again

What is actually happening?

Test 3 first template with a v-once re renders all the time. Workaround is to append an empty span: <template v-once>[{{ getTime() }}] {{ obj.msg }}<span/></template>
Test 5: the second template with v-once still rerenders. Workaround is to use a different tag like a span or use the v-once on the parent.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @posva

        Issue actions

          v-once on template not working inside a v-for in two cases · Issue #10906 · vuejs/vue