Skip to content

Commit 43eb4a5

Browse files
fix: block throwing undefined error
Co-authored-by: daniel <[email protected]>
1 parent a1cba58 commit 43eb4a5

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Diff for: src/lib/utils.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,14 @@ const groupBlockContent = (blockMap: BlockMap) => {
1212
let index = -1
1313

1414
Object.keys(blockMap).forEach((id) => {
15-
blockMap[id].value.content?.forEach((blockId) => {
16-
const blockType = blockMap[blockId]?.value?.type
15+
const blockValue = blockMap[id]?.value
16+
if (!blockValue?.content) return
17+
18+
blockValue.content.forEach((blockId) => {
19+
const nestedBlock = blockMap[blockId]?.value
20+
if (!nestedBlock) return
21+
22+
const blockType = nestedBlock.type
1723

1824
if (blockType && blockType !== lastType) {
1925
index++

0 commit comments

Comments
 (0)