Subscribe on changes!

Slot not updating from nested v-for

avatar
Mar 3rd 2021

Version

3.0.7

Reproduction link

https://codesandbox.io/s/vue-3-slot-bug-6hj9c

Steps to reproduce

Click the buttons and compare the expected with actual behaviour.

What is expected?

The slot should update the visible content to the results in the computed.

What is actually happening?

The slot isn't updating.


It took me a long time to figure out what might be causing this bug. It seems to be the combination of a few different things:

  1. The hierarchical data in the computed isn't deeply reactive
  2. The v-for is used on the "First" component and the default slot has elements that need updating
  3. The "First" component uses the "Second" component to encapsulate the slot
  4. There's a slot that is v-if'ed in the "First" component
avatar
Mar 4th 2021

a tip here: return false in shouldUpdateComponent() maybe patchFlag is incorrect. too busy to look into deep.