Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/few-icons-repeat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@craftjs/core': patch
---

Correctly serialize null props
6 changes: 4 additions & 2 deletions packages/core/src/utils/serializeNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ export const serializeComp = (
props = Object.keys(props).reduce((result: Record<string, any>, key) => {
const prop = props[key];

if (prop === undefined || prop === null || typeof prop === 'function') {
if (prop === undefined || typeof prop === 'function') {
return result;
}

if (key === 'children' && typeof prop !== 'string') {
if (prop === null) {
result[key] = null;
} else if (key === 'children' && typeof prop !== 'string') {
result[key] = Children.map(prop, (child) => {
if (typeof child === 'string') {
return child;
Expand Down
Loading