diff --git a/src/runtime/entrypoints/main.ts b/src/runtime/entrypoints/main.ts index 6802e48e..4b8d05d3 100644 --- a/src/runtime/entrypoints/main.ts +++ b/src/runtime/entrypoints/main.ts @@ -90,7 +90,7 @@ ServerComponent.displayName = "PreactServerComponent"; function addPropsChild(parent: VNode, vnode: ComponentChildren) { const props = parent.props; - if (props.children === null) { + if (props.children == null) { props.children = vnode; } else { if (!Array.isArray(props.children)) { @@ -118,7 +118,7 @@ interface Marker { endNode: Text | Comment | null; } -const HIDE_MARKERS = true; +const SHOW_MARKERS = false; /** * Replace comment markers with empty text nodes to hide them @@ -129,7 +129,7 @@ function hideMarker(marker: Marker) { const parent = endNode!.parentNode!; if ( - !HIDE_MARKERS && startNode !== null && + SHOW_MARKERS && startNode !== null && startNode.nodeType === Node.COMMENT_NODE ) { const text = new Text(""); @@ -139,7 +139,7 @@ function hideMarker(marker: Marker) { } if ( - !HIDE_MARKERS && endNode !== null && endNode.nodeType === Node.COMMENT_NODE + SHOW_MARKERS && endNode !== null && endNode.nodeType === Node.COMMENT_NODE ) { const text = new Text(""); marker.endNode = text; @@ -148,6 +148,50 @@ function hideMarker(marker: Marker) { } } +/** + * If an islands children are `null` then it might be a conditionally + * rendered one which was initially not visible. In these cases we + * send a `