From 1b39eba6ed6be11c0de8820650be652a6078bdff Mon Sep 17 00:00:00 2001 From: Jordan Lawrence Date: Tue, 16 Jul 2024 17:25:08 +0100 Subject: [PATCH] fix(bundles): handling latest bundle having no name --- packages/sanity/src/core/bundles/components/BundleMenu.tsx | 2 +- .../src/core/releases/contexts/BundlesMetadataProvider.tsx | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/sanity/src/core/bundles/components/BundleMenu.tsx b/packages/sanity/src/core/bundles/components/BundleMenu.tsx index 5037e2cfe31..079f33a4a04 100644 --- a/packages/sanity/src/core/bundles/components/BundleMenu.tsx +++ b/packages/sanity/src/core/bundles/components/BundleMenu.tsx @@ -75,7 +75,7 @@ export function BundleMenu(props: BundleListProps): JSX.Element { .filter((b) => !isDraftOrPublished(b.name) && !b.archivedAt) .map((b) => ( { - setListenerBundleSlugs((prevSlugs) => [...prevSlugs, ...addBundleSlugs]) + const addBundleSlugsToListener = useCallback((addBundleSlugs: (string | undefined)[]) => { + const isString = (slug: string | undefined): slug is string => !!slug + + setListenerBundleSlugs((prevSlugs) => [...prevSlugs, ...addBundleSlugs.filter(isString)]) }, []) const removeBundleSlugsFromListener = useCallback((removeBundleSlugs: string[]) => {