Calling a composable from inside computed doesn't call onMounted
I'm using Nuxt3 and Vue3 and having trouble getting my composables to work properly. My composable contains an onMounted() call, but that call only seems to work in certain situations. My composable, useSableCan, calls setInterval inside onMounted, and clears in onUnmounted. When I call this composable from the root of my SFC steup script, the onMounted works and logs to console. But when I call it from inside a computed function, nothing... here is my code. Any thoughts?
1 Reply
I looked into this more and it seems that you cannot call lifecycle hooks inside a computed function. I may have to manage the mount and unmount manually.