Subscribe on changes!

OnActivated does not trigger when element is added to the page after timeout

avatar
Jul 19th 2022

Vue version

3.2.37

Link to minimal reproduction

https://stackblitz.com/edit/vitejs-vite-htwvba

Steps to reproduce

  1. Wait 3 seconds
  2. "ACTIVATED" is never printed, even though the element is now visible

What is expected?

The onActivated-hook should run once

What is actually happening?

The onActivated-hook never runs

System Info

No response

Any additional comments?

No response

avatar
Jul 20th 2022

Registers a callback to be called after the component instance is inserted into the DOM as part of a tree cached by .

https://vuejs.org/api/composition-api-lifecycle.html#onactivated

You might be looking for onMounted