I still cannot make it happen:
By your advice, we added the includeRefs to the page:
// This page is purely for using the Builder.io editor to edit symbols
export default function EditBuilderSymbol() {
return (
<BuilderComponent
model="hero"
options={{
includeRefs: true,
}}
/>
)
}
The symbol bindings:
so REFERENCE here (but I won’t pass the reference to the symbol, I will pass the value)!
$block.eval(‘state’) log: shows it’s not only the data, all the meta fields as well, because we bind the reference in the symbol state, (and with the includeRefs: true, it also holds the value)
And in the symbol we bind the data through:
For example:
state.hero.value.data?.description?.[state.locale]
And in my code, that’s why I try to bind to:
fetch the data:
let tophero =
(await builder
.get('hero-data', {
query: {
id: '7de8be4731ec4ea69e532adc4e23c095',
},
})
.promise()) || null
my tophero console.log
{
createdBy: 'uw0UJ7VD7hS21zDPkekcB9zZgAD3',
createdDate: 1659639067133,
data: {
buttonList: {},
description: {
'@type': '@builder.io/core:LocalizedValue',
hu: 'Ismerd meg, hogyan használják a mások szerte a világon a Bariont a fizetési megoldásokhoz, az adatvezérelt felhasználói élmény javítására és az ügyfelek örömére.'
},
hasUnderline: true,
heroContent: {},
isFirstH1: true,
superTitle: {},
title: {
'@type': '@builder.io/core:LocalizedValue',
hu: '<p>Barion ügyfelek sikertörténetei</p>'
}
},
id: '7de8be4731ec4ea69e532adc4e23c095',
lastUpdatedBy: 'uw0UJ7VD7hS21zDPkekcB9zZgAD3',
meta: { kind: 'data' },
modelId: '60f37630962b4321934183c65ceec2a8',
name: 'customer-stories-hero',
published: 'published',
query: [],
testRatio: 1,
variations: {},
lastUpdated: 1659639198094,
firstPublished: 1659639164966,
rev: 'bxv7z2u3k4e'
}
So the symbol should store the data inside state.hero.value:
<BuilderComponent
model="hero"
options={{
query: '47854896424f4ae499952e68dc539a59',
key: 'tophero',
includeRefs: true,
noTraverse: false,
}}
data={{
hero: {
value: tophero,
},
locale: locale,
}}
/>
I tried with removing the options includeRefs, noTraverse but did not help.
In my opinion, this should work, because I pass the locale, and the hero.value to the symbol, but I still got:
I also tried with hardcoded values just because of curiosity, I want to go with the previous approach:
<BuilderComponent
model="hero"
options={{
query: '47854896424f4ae499952e68dc539a59',
key: 'tophero',
includeRefs: true,
}}
data={{
hero: {
'@type': '@builder.io/core:Reference',
id: '01da92a9dd324ae086fa21a657b35594',
model: 'hero-data',
},
locale: locale,
}}
/>
same no-content.
Hope now it makes sense, and you can help me figure out, what is the problem.