From c8d3865154a35253cfa552abf30b0da497fb1059 Mon Sep 17 00:00:00 2001 From: Emma Hamilton Date: Tue, 15 Oct 2024 09:34:46 +1000 Subject: [PATCH] Show columns of other entries on the collection page when some entries fail to parse (#1331) --- .changeset/swift-emus-film.md | 5 +++++ packages/keystatic/src/app/CollectionPage.tsx | 12 +++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) create mode 100644 .changeset/swift-emus-film.md diff --git a/.changeset/swift-emus-film.md b/.changeset/swift-emus-film.md new file mode 100644 index 000000000..8e687ca6a --- /dev/null +++ b/.changeset/swift-emus-film.md @@ -0,0 +1,5 @@ +--- +'@keystatic/core': patch +--- + +Show columns of other entries on the collection page when some entries fail to parse diff --git a/packages/keystatic/src/app/CollectionPage.tsx b/packages/keystatic/src/app/CollectionPage.tsx index 4cb8bfbf0..67114a3ee 100644 --- a/packages/keystatic/src/app/CollectionPage.tsx +++ b/packages/keystatic/src/app/CollectionPage.tsx @@ -359,8 +359,9 @@ function CollectionTable( ); const glob = getSlugGlobForCollection(props.config, props.collection); const rootSchema = { kind: 'object' as const, fields: collection.schema }; - return new Map( - entries.map(([slug, dataFile]) => { + const parsedEntries = new Map>(); + for (const [slug, dataFile] of entries) { + try { const { loaded } = loadDataFile(dataFile, formatInfo); const validated = parseProps( rootSchema, @@ -394,9 +395,10 @@ function CollectionTable( }, true ); - return [slug, validated as Record] as const; - }) - ); + parsedEntries.set(slug, validated as Record); + } catch {} + } + return parsedEntries; }, [ collection, props.config,