diff --git a/package.json b/package.json index 4a3250e..ab0d94c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "cyberduck", "private": false, - "version": "1.0.1", + "version": "1.0.2", "repository": { "type": "git", "url": "git+https://git.maze.io/maze/cyberduck.git" diff --git a/src/components/Layout/Split.tsx b/src/components/Layout/Split.tsx index c8cd729..1c4a842 100644 --- a/src/components/Layout/Split.tsx +++ b/src/components/Layout/Split.tsx @@ -53,7 +53,7 @@ const Split: React.FC & { Panel: React.FC } = ({ // detect Panel children and extract sizes and passthrough props const sizes: (number | null)[] = childrenArray.map((c) => { - if (React.isValidElement(c) && (c.type as any).displayName === 'SplitPanel') { + if (React.isValidElement(c) && (c.type as any)?.displayName === 'SplitPanel') { const p = c as React.ReactElement return typeof p.props.size === 'number' ? p.props.size : 1 } @@ -71,7 +71,7 @@ const Split: React.FC & { Panel: React.FC } = ({ let extraClass = '' let extraStyle: React.CSSProperties | undefined - if (React.isValidElement(child) && (child.type as any).displayName === 'SplitPanel') { + if (React.isValidElement(child) && (child.type as any)?.displayName === 'SplitPanel') { const p = child as React.ReactElement extraClass = p.props.className || '' extraStyle = p.props.style @@ -90,7 +90,9 @@ const Split: React.FC & { Panel: React.FC } = ({ } const mergedStyle = extraStyle ? { ...style, ...extraStyle } : style - const childElem = React.isValidElement(child) ? (child as React.ReactElement) : null + const childElem = React.isValidElement(child) && (child.type as any)?.displayName === 'SplitPanel' + ? (child as React.ReactElement) + : null const variant = childElem ? childElem.props.variant ?? splitVariant : splitVariant // Determine accent: a panel with its own `accent` always uses it. // Otherwise, if the parent `Split` has an `accent`, only the first