From bd1fe47ffb87aca8d5a26c22e5d8a1f09a51cef6 Mon Sep 17 00:00:00 2001 From: ririxi Date: Sat, 15 Feb 2025 01:25:16 +0100 Subject: [PATCH] fix(tagsdiv): ensure there's empty array to sort (#897) --- src/components/Card/TagsDiv.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Card/TagsDiv.tsx b/src/components/Card/TagsDiv.tsx index f2f17848..e292fe55 100644 --- a/src/components/Card/TagsDiv.tsx +++ b/src/components/Card/TagsDiv.tsx @@ -50,7 +50,7 @@ const TagsDiv = (props: { }, []); }; // Sort tags so that externalJS and archived tags come first - let baseTags = props.tags.sort((a) => (a === t("grid.externalJS") || a === t("grid.archived") ? -1 : 1)); + let baseTags = [...(props.tags ?? [])].sort((a) => (a === t("grid.externalJS") || a === t("grid.archived") ? -1 : 1)); let extraTags: string[] = []; // If there are more than one extra tags, slice them and add an expand button if (baseTags.length - MAX_TAGS > 1) {