Skip to content

Commit c9aa648

Browse files
authored
Fix entries with a slug of header breaking the collection table (#1439)
1 parent 21643d9 commit c9aa648

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

.changeset/friendly-dodos-punch.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@keystatic/core': patch
3+
---
4+
5+
Fix entries with a slug of `header` breaking the collection table

packages/keystatic/src/app/CollectionPage.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,13 @@ function CollectionTable(
497497
overflowMode="truncate"
498498
prominence="low"
499499
onAction={key => {
500-
router.push(getItemPath(props.basePath, props.collection, key));
500+
router.push(
501+
getItemPath(
502+
props.basePath,
503+
props.collection,
504+
key.toString().slice('key:'.length)
505+
)
506+
);
501507
}}
502508
renderEmptyState={() => (
503509
<EmptyState
@@ -554,7 +560,7 @@ function CollectionTable(
554560
);
555561
if (collection.columns?.length) {
556562
return (
557-
<Row key={item.name}>
563+
<Row key={'key:' + item.name}>
558564
{[
559565
...(hideStatusColumn ? [] : [statusCell]),
560566
nameCell,
@@ -578,9 +584,9 @@ function CollectionTable(
578584
);
579585
}
580586
return hideStatusColumn ? (
581-
<Row key={item.name}>{nameCell}</Row>
587+
<Row key={'key:' + item.name}>{nameCell}</Row>
582588
) : (
583-
<Row key={item.name}>
589+
<Row key={'key:' + item.name}>
584590
{statusCell}
585591
{nameCell}
586592
</Row>

0 commit comments

Comments
 (0)