`beforeUpdate` is not called if we explicitly state `v-slot:default`
See original GitHub issueVersion
2.6.11
Reproduction link
https://jsfiddle.net/WofWca/da0v8nqc/23/
Steps to reproduce
Click on the gray box under “With `v-slot:default`:”
What is expected?
beforeUpdate
of WithVSlot
component is called.
What is actually happening?
It is NOT called.
Under “No `v-slot`:” there is an identical component, except it lacks v-slot:default
. It works as I expect it.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:7 (6 by maintainers)
Top Results From Across the Web
javascript - beforeUpdate doesn't seem to be called
How are you updating the user? There is a difference between getting an instance of the user and updating it and updating by...
Read more >Vincit/objection.js - Gitter
I am wondering if there is any instance method on the Model (or smth else ... $beforeUpdate and $afterUpdate are called for the...
Read more >beforeUpdate - Velo API Reference - Wix.com
The beforeUpdate() hook runs when: The update() function is called. An action is performed on a dataset that updates an item from the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
i looked into this a little more none of the lifecycle hooks get triggered in that first failing component e. g ‘updated’ is also not triggered
Edit
It looks like the Dep being created for beforeUpdateCallCount is not being set correctly with the ‘with-v-slot’ component.
‘my-component-with-slot’ is being added as a sub to the Dep for that variable but ‘with-v-slot’ is not. i.e, the update to that value is not going beyond ‘my-component-with-slot’
there are two separate Dep’s being created for that beforeUpdateCallCount variable. so I can see it adding ‘with-v-slot’ as a sub, but when the actual click handler happens and the value changes, the wrong Dep is sending notifications. i can tell because this.uid in the Dep does not match the Dep that ‘with-v-slot’ is subscribed to
It’s because the implementation is different, like @KaelWD said, the point of https://github.com/vuejs/vue/issues/9756 is to make it consistent by making it both lazily invoked, which is more performant but also does not trigger the
beforeUptade
. And that aligns with how slots work in Vue 3