Skip to content

Commit

Permalink
fix(project): skip playlist fetch when no playlistid
Browse files Browse the repository at this point in the history
  • Loading branch information
royschut committed May 11, 2021
1 parent 1b4aad1 commit f2f12a9
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
2 changes: 1 addition & 1 deletion src/hooks/usePlaylist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ const getPlaylistById = (playlistId: string) => {
export type UsePlaylistResult<TData = Playlist, TError = unknown> = UseBaseQueryResult<TData, TError>;

export default function usePlaylist(playlistId: string): UsePlaylistResult {
return useQuery(['playlist', playlistId], () => getPlaylistById(playlistId));
return useQuery(['playlist', playlistId], () => getPlaylistById(playlistId), { enabled: !!playlistId });
}
4 changes: 0 additions & 4 deletions src/screens/Home/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,6 @@ const Home = (): JSX.Element => {

return (
<div className={styles.home}>
{/* <InfiniteLoader isRowLoaded={(index) => !!content[index]} loadMoreRows={loadMoreRows} rowCount={5}>
{({ onRowsRendered, registerChild }) => ( */}
<WindowScroller onResize={() => ((listRef.current as unknown) as List)?.recomputeRowHeights()}>
{({ height, isScrolling, onChildScroll, scrollTop }) => (
<List
Expand All @@ -114,8 +112,6 @@ const Home = (): JSX.Element => {
/>
)}
</WindowScroller>
{/* )}
</InfiniteLoader> */}
</div>
);
};
Expand Down

0 comments on commit f2f12a9

Please sign in to comment.