Skip to content

Commit 06a19f6

Browse files
committed
move conditional earlier, and combine conditional renders
1 parent 03a098e commit 06a19f6

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/components/ListenToPlayer/index.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ const ListenToPlayer = ({ slug }: { slug: string }) => {
120120
}
121121
}, [playbackSpeed, sound])
122122

123+
// Only show the player if the locale is English and there is a playlist, renders null early
124+
if (!playlist.length || index === -1 || locale !== "en") return null
125+
123126
const handlePlayPause = () => {
124127
if (!sound) return
125128

@@ -209,10 +212,6 @@ const ListenToPlayer = ({ slug }: { slug: string }) => {
209212
})
210213
}
211214

212-
if (!playlist.length || index === -1) return null
213-
214-
if (locale !== "en") return null
215-
216215
return (
217216
<>
218217
<TopOfPagePlayer

0 commit comments

Comments
 (0)