Skip to content

Unhandled error during execution of scheduler flush when rendering components in a transition group that have a v-if directive #5168

Closed
@adamreisnz

Description

@adamreisnz

Version

3.2.26

Reproduction link

sfc.vuejs.org/

Steps to reproduce

I am using a transition group as follows:

<transition-group name="foo" tag="div" appear>
...
</transition-group>

Within it, I have a list of custom components. If I apply a v-if on these components within the parent template, everything works as expected:

<transition-group name="foo" tag="div" appear>
  <other-component v-for="item in items"  :key="item.id" />
  <foo-component key="foo" :foos="foos" v-if="foos.length > 0" />
  <bar-component key="bar" :bars="bars" v-if="bars.length > 0" />
</transition-group>

Both foos and bars are loaded asynchronously, and the components appear correctly with a transition animation as soon as the items are loaded and available.

However, I tried to refactor this to letting the components load the items themselves, and if I move the v-if into the child component (still on the outer most HTML element), as follows:

<transition-group name="foo" tag="div" appear>
  <other-component v-for="item in items"  :key="item.id" />
  <!-- now these components load their items themselves, and govern their own appearance with an internal `v-if` -->
  <foo-component />
  <bar-component />
</transition-group>

This however triggers a series of errors in the console:

Unhandled error during execution of render function 
Unhandled error during execution of scheduler flush. This is likely a Vue internals bug. Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/vue-next 
TypeError: child.el.getBoundingClientRect is not a function

What is expected?

That if using a v-if inside of a child component which is listed in a transition-group, this works as expected.

What is actually happening?

The error as above is thrown and v-for some of the components in the transition group fail to render.


Trying to render components in a transition group and govern their appearance internally in the component instead of externally in the parent component.

To reproduce in the playground, remove the v-if condition on the Bar.vue component to make the example work, then put it back to trigger the error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    🔨 p3-minor-bugPriority 3: this fixes a bug, but is an edge case that only affects very specific usage.🐞 bugSomething isn't workinghas workaroundA workaround has been found to avoid the problemscope: transition

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions