Handle `MaybeComputedRef` for UseJsonld input field
Currently, useHead can handle MaybeComputedRef like below:
// static
useHead({
title: "title",
});
// function
useHead(() => ({
title: someRef,
}))
// ref, computed, and reactive
useHead({
title: someRef,
})
useJsonld can only handle a static object and a function.
// static
useJsonld({
name: "title",
});
// function
useJsonld(() => ({
name: someRef.value, // .value needed
}))
- [ ] Handle
MaybeComputedReflikeuseHead - [ ] Fix broken link to
useHeadin README
working on nuxt-jsonld/tree/reactive
Any update? I am trying to use a computedRef inside of useJsonld and I am getting this error:
"Converting circular structure to JSON\n --> starting at object with constructor 'ComputedRefImpl'\n | property 'effect' -> object with constructor 'ReactiveEffect'\n --- property 'computed' closes the circle",
Hi @TimGuendel. Currently you can not pass a computed value directly:
// This does not work
const nameComputed = computed(() => 'Alice');
ustJsonld({
name: nameComputed,
});
However, you can do this:
// This works fine
const nameComputed = computed(() => 'Alice');
ustJsonld(() => ({
name: nameComputed.value,
}));
Converting circular structure to JSON
Please make sure there are no circular references in your object.