bau.derive collects the dependencies automatically when the derivation function is called for the first time.
In Vue this actually works:
<script setup>
import { ref, computed } from 'vue'
const msg = ref("");
const count = ref(0);
const mycomputedval = computed(() => {
if (!msg.value) return "";
if (!count.value) return "";
return `${msg.value}, ${count.value}`;
});
function onClick() {
if (!msg.value) {
msg.value = "hello world";
return;
}
count.value += 1;
}
</script>
<template>
<h1>{{ mycomputedval }}</h1>
<button @click="onClick">Press me</button>
</template>
I think similarly bau.derive should collect dependencies on subsequent runs.
In Vue this actually works:
I think similarly
bau.deriveshould collect dependencies on subsequent runs.