Closed michealroberts closed 11 months ago
the issue here is the incorrect use of async operations:
const sequenceNodes = editor.getNodes() // is called before any editor.addNode in the forEach
console.log(sequenceNodes)
This should have await
sequences.forEach(async (sequence) => {
to
await Promise.all(sequences.map(async (sequence) => {
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 10 days.
I have the following code:
Which adds a sample of nodes from a given data array.
Then, when calling the following:
I get an empty array.
I'm kind of confused by this behaviour, if I log inside the
forEach
loop, I see that the nodes are being added. Furthermore, the nodes are rendering correctly.For reference, this is the createNode function:
This for me feels like a scoping bug?
Could someone explain why this dynamic adding of nodes doesn't seem to work outside of different scopes?