So, let's hypothetically say I have the following setup:
<script setup lang="ts">
const someRef = ref<null | string>(null)
const setSomeRef = (v: string) => {
someRef.value = v
}
const watcher1 = watch(someRef, () => {
doSomething()
})
const watcher2 = watch(someRef, () => {
doSomethingElse()
})
</script>
<template>
<button @click="setSomeRef("Hello!")">Hit Me!</button>
</template>
Let's also just hypothetically imagine that these two watchers might be in two different composables, but maybe instantiated on the same component ... for reasons.
A user clicks the button.
My thought is, which function fires first? doSomething() or `doSomethingElse()?
Do they always fire in the same order? ... and does it matter if the side effects are unrelated, i.e., is the perceived difference negligible?