Skip to content

Commit

Permalink
HOTFIX track notification navigation (#3335)
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanjeffers authored May 4, 2023
1 parent f30507c commit 869504c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
19 changes: 12 additions & 7 deletions packages/mobile/src/hooks/useNotificationNavigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export const useNotificationNavigation = () => {
) => {
const { entityType, entityId } = notification
if (entityType === Entity.Track) {
navigation.navigate('Track', { id: entityId })
navigation.navigate('Track', { id: entityId, canBeUnlisted: false })
} else if (
entityType === Entity.Album ||
entityType === Entity.Playlist
Expand All @@ -131,7 +131,7 @@ export const useNotificationNavigation = () => {
} else {
navigation.navigate(
notification.entityType === Entity.Track ? 'Track' : 'Collection',
{ id: notification.entityId }
{ id: notification.entityId, canBeUnlisted: false }
)
}
} else if (notification.type === PushNotificationType.MilestoneFollow) {
Expand All @@ -141,7 +141,7 @@ export const useNotificationNavigation = () => {
notification.actions[0].actionEntityType === Entity.Track
? 'Track'
: 'Collection',
{ id: notification.entityId }
{ id: notification.entityId, canBeUnlisted: false }
)
}
},
Expand Down Expand Up @@ -215,7 +215,8 @@ export const useNotificationNavigation = () => {
id:
'childTrackId' in notification
? notification.childTrackId
: notification.entityId
: notification.entityId,
canBeUnlisted: false
})
},
[NotificationType.RemixCreate]: (
Expand All @@ -225,7 +226,8 @@ export const useNotificationNavigation = () => {
id:
'childTrackId' in notification
? notification.childTrackId
: notification.entityId
: notification.entityId,
canBeUnlisted: false
})
},
[PushNotificationType.RepostAlbum]: socialActionHandler,
Expand Down Expand Up @@ -258,7 +260,10 @@ export const useNotificationNavigation = () => {
[NotificationType.TrendingTrack]: (
notification: TrendingTrackNotification
) => {
navigation.navigate('Track', { id: notification.entityId })
navigation.navigate('Track', {
id: notification.entityId,
canBeUnlisted: false
})
},
[NotificationType.UserSubscription]: (
notification: UserSubscriptionNotification
Expand All @@ -271,7 +276,7 @@ export const useNotificationNavigation = () => {
} else {
navigation.navigate(
notification.entityType === Entity.Track ? 'Track' : 'Collection',
{ id: notification.entityIds[0] }
{ id: notification.entityIds[0], canBeUnlisted: false }
)
}
},
Expand Down
6 changes: 2 additions & 4 deletions packages/mobile/src/screens/track-screen/TrackScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { useRoute } from 'app/hooks/useRoute'
import { makeStyles } from 'app/styles'

import { TrackScreenMainContent } from './TrackScreenMainContent'
import { TrackScreenSkeleton } from './TrackScreenSkeleton'
const { fetchTrack } = trackPageActions
const { tracksActions } = trackPageLineupActions
const { getLineup, getRemixParentTrack, getTrack, getUser } = trackPageSelectors
Expand Down Expand Up @@ -89,10 +90,7 @@ export const TrackScreen = () => {
useFocusEffect(handleFetchTrack)

if (!track || !user) {
console.warn(
'Track, user, or lineup missing for TrackScreen, preventing render'
)
return null
return <TrackScreenSkeleton />
}

const handlePressGoToRemixes = () => {
Expand Down

0 comments on commit 869504c

Please sign in to comment.