question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`beforeUpdate` is not called if we explicitly state `v-slot:default`

See original GitHub issue

Version

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:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
desprestoncommented, Jan 13, 2020

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

0reactions
posvacommented, Jan 14, 2020

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found