From 16c925029cd6eed081c267ebb50083417350725a Mon Sep 17 00:00:00 2001 From: Jonas Carlsen Date: Fri, 1 Nov 2024 10:14:57 +0100 Subject: [PATCH] fix: only slice favorite subjects if they exist --- src/containers/MyNdla/MyNdlaPage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/containers/MyNdla/MyNdlaPage.tsx b/src/containers/MyNdla/MyNdlaPage.tsx index 8b885fa8c..1167e31b9 100644 --- a/src/containers/MyNdla/MyNdlaPage.tsx +++ b/src/containers/MyNdla/MyNdlaPage.tsx @@ -69,7 +69,7 @@ const MyNdlaPage = () => { const { user, authContextLoaded, authenticated } = useContext(AuthContext); const { t, i18n } = useTranslation(); const { trackPageView } = useTracker(); - const recentFavouriteSubjectsQuery = useFavouriteSubjects(user?.favoriteSubjects.slice(0, 4) ?? [], { + const recentFavouriteSubjectsQuery = useFavouriteSubjects(user?.favoriteSubjects?.slice(0, 4) ?? [], { skip: !user?.favoriteSubjects.length, }); const { allFolderResources } = useRecentlyUsedResources(!authenticated);