Hi, I am facing a strange issue while updating the blocks in a workdocs. We have added a doc action in Contextual toolbar and Add block menu which performs same functionality and using Monday SDK to update the doc blocks.
And trying to update the blocks by iterating as suggest in the example app quickstart-workdocs. The code I am using is
const updateBlock = async (id: string, content: any) => {
const data = await monday.execute('updateDocBlock', { id, content });
return data;
}
blocks.forEach(async (block) => {
const content = JSON.parse(block.content);
const data = await updateBlock(block.id, content);
return data;
})
The problem is, the doc action is working fine when performed from Add block menu. But while performing the doc action from Contextual toolbar then the changes are applying for first block only and other blocks are not updating. Also I see in network tab it’s making call for first block and not for other blocks. Have anyone experienced the same issue, any idea what could be the reason?
Your help would be greatly appreciated. Thanks