From 817a758b8a2a5ef523856a8ceb327107309816cc Mon Sep 17 00:00:00 2001 From: Fredrik Burmester Date: Sun, 18 Aug 2024 10:51:35 +0200 Subject: [PATCH] fix: double routing bug --- components/common/TouchableItemRouter.tsx | 30 ++++++++++++++++++----- 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/components/common/TouchableItemRouter.tsx b/components/common/TouchableItemRouter.tsx index 9bb83768..e1012af5 100644 --- a/components/common/TouchableItemRouter.tsx +++ b/components/common/TouchableItemRouter.tsx @@ -25,15 +25,33 @@ export const TouchableItemRouter: React.FC> = ({ onPress={() => { Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light); - if (item.Type === "Series") router.push(`/series/${item.Id}`); - if (item.Type === "Episode") router.push(`/items/${item.Id}`); - if (item.Type === "MusicAlbum") router.push(`/albums/${item.Id}`); - if (item.Type === "Audio") router.push(`/albums/${item.AlbumId}`); - if (item.Type === "MusicArtist") + if (item.Type === "Series") { + router.push(`/series/${item.Id}`); + return; + } + if (item.Type === "Episode") { + router.push(`/items/${item.Id}`); + return; + } + if (item.Type === "MusicAlbum") { + router.push(`/albums/${item.Id}`); + return; + } + if (item.Type === "Audio") { + router.push(`/albums/${item.AlbumId}`); + return; + } + if (item.Type === "MusicArtist") { router.push(`/artists/${item.Id}/page`); + return; + } // Movies and all other cases - if (item.Type === "BoxSet") router.push(`/collections/${item.Id}`); + if (item.Type === "BoxSet") { + router.push(`/collections/${item.Id}`); + return; + } + router.push(`/items/${item.Id}`); }} {...props}