You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I recently updated vueUse to the latest version and noticed the tryOnMounted hook was added inside couple of the composables. The issue that I have is that when I try to change my route hash (which triggers an 'beforeUpdateandupdated` lifecycle hook, it's getting into the method and intervening with my logic.
for example. inside useScroll, it's not updating my y.value. (unless I wrap it within a setTimeout). [waiting after tryOnMounted to be executed]
inside useElementSize its setting the width and height again, which is triggering a watcher I have inside the component on every route hash change.
I would suggest passing an option to the composables to disable the tryOnMounted hook. or reconsider using it all together within some of the composables.
Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Make sure this is a VueUse issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/core instead.
Check that this is a concrete bug. For Q&A open a GitHub Discussion.
I believe tryOnMounted was added to that composables are reasonable cause those functions like useElementSize or useScroll are indeed need to get/set dom
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug
I recently updated vueUse to the latest version and noticed the
tryOnMounted
hook was added inside couple of the composables. The issue that I have is that when I try to change my route hash (which triggers an 'beforeUpdateand
updated` lifecycle hook, it's getting into the method and intervening with my logic.for example. inside
useScroll
, it's not updating my y.value. (unless I wrap it within a setTimeout). [waiting aftertryOnMounted
to be executed]inside
useElementSize
its setting the width and height again, which is triggering a watcher I have inside the component on every route hash change.I would suggest passing an option to the composables to disable the
tryOnMounted
hook. or reconsider using it all together within some of the composables.Reproduction
https://github.com/vueuse/vueuse/blob/main/packages/shared/tryOnMounted/index.ts
System Info
Used Package Manager
pnpm
Validations
The text was updated successfully, but these errors were encountered: