Troubleshooting·Fail near the cause
Orphan computation error
A computed definition was used before it was inserted into a reactive object.
What happened
Cannot modify or access the value of an orphan computation.
computed returns a definition that tilia turns into a value when it is inserted into a tilia or carve object. Reading, changing, serializing, or otherwise using that definition before insertion raises this error.
Only computed definitions use this orphan guard. source and store have different lifecycles.
Define it where it is inserted
Do not keep a computed definition in an intermediate variable:
const doubled = computed(() => count.value * 2);
console.log(doubled);let doubled = computed(() => count.value * 2)
Console.log(doubled)Insert the definition directly into the reactive object:
const counter = tilia({
doubled: computed(() => count.value * 2),
});
console.log(counter.doubled);let counter = tilia({
doubled: computed(() => count.value * 2),
})
Console.log(counter.doubled)When the result must live on its own, use derived, which returns a signal whose current result is available at .value.
Still seeing the error?
Check the stack frame immediately above tilia's internals. It should point to the first operation that used the definition as a value. Move that computed call directly into the object that owns the property.
If a definition is already inserted directly and the error still occurs, open a GitHub issue with a minimal reproduction and the complete stack trace.