From fc3761ab1982ddece5db194ac9b2030c5154cf0e Mon Sep 17 00:00:00 2001 From: Daniel Lautzenheiser Date: Fri, 14 Jul 2023 09:13:00 -0400 Subject: [PATCH] fix: list preview --- .../src/components/collections/CollectionControls.tsx | 1 - packages/core/src/widgets/list/ListPreview.tsx | 8 ++++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/core/src/components/collections/CollectionControls.tsx b/packages/core/src/components/collections/CollectionControls.tsx index 24694aaf..aa2ebd24 100644 --- a/packages/core/src/components/collections/CollectionControls.tsx +++ b/packages/core/src/components/collections/CollectionControls.tsx @@ -73,7 +73,6 @@ const CollectionControls = ({ sm:w-auto sm:justify-normal lg:gap-2 - flex-[1_0_0%] " > diff --git a/packages/core/src/widgets/list/ListPreview.tsx b/packages/core/src/widgets/list/ListPreview.tsx index f4e951c8..3a46153a 100644 --- a/packages/core/src/widgets/list/ListPreview.tsx +++ b/packages/core/src/widgets/list/ListPreview.tsx @@ -1,6 +1,6 @@ import React from 'react'; -import { isNotNullish } from '@staticcms/core/lib/util/null.util'; +import { isNullish } from '@staticcms/core/lib/util/null.util'; import type { ListField, ValueOrNestedValue, WidgetPreviewProps } from '@staticcms/core/interface'; import type { FC, ReactNode } from 'react'; @@ -8,6 +8,10 @@ import type { FC, ReactNode } from 'react'; function renderNestedList( value: ValueOrNestedValue[] | ValueOrNestedValue | null | undefined, ): ReactNode { + if (isNullish(value)) { + return null; + } + if (Array.isArray(value)) { return (