Skip to content

Commit b1a3eec

Browse files
hjalm8christianhg
authored andcommitted
fix: give markDefs a fallback value if it is null
1 parent acf4977 commit b1a3eec

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/buildMarksTree.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ import type {ToolkitNestedPortableTextSpan, ToolkitTextNode} from './types'
4242
export function buildMarksTree<M extends PortableTextMarkDefinition = PortableTextMarkDefinition>(
4343
block: PortableTextBlock<M>,
4444
): (ToolkitNestedPortableTextSpan<M> | ToolkitTextNode | ArbitraryTypedObject)[] {
45-
const {children, markDefs = []} = block
45+
const {children} = block
46+
const markDefs = block.markDefs ?? []
4647
if (!children || !children.length) {
4748
return []
4849
}

0 commit comments

Comments
 (0)