Skip to content

Collect dependencies subsequent runs bau.derive #162

@louwers

Description

@louwers

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions