Skip to content

Commit

Permalink
perf: improve performance
Browse files Browse the repository at this point in the history
  • Loading branch information
Sherlockouo committed Dec 6, 2023
1 parent 897b371 commit 80913e6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
7 changes: 3 additions & 4 deletions packages/web/pages/Artist/ArtistSongs.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useEffect, useState } from 'react'
import { memo, useEffect, useState } from 'react'
import useArtistSongs from '@/web/api/hooks/useArtistSongs'
import useTracks from '@/web/api/hooks/useTracks'
import { FetchArtistSongsParams } from '@/shared/api/Artist'
Expand All @@ -8,9 +8,8 @@ import { useParams } from 'react-router-dom'
import ScrollPagination from '@/web/components/ScrollPage'
import { fetchArtistSongs } from '@/web/api/artist'
import { fetchTracks } from '@/web/api/track'
import toast from 'react-hot-toast'

const ArtistSongs = () => {
const ArtistSongs = memo(() => {
const [dataSource, setDatasource] = useState<Track[]>([])
const [songIDs, setSongIDs] = useState<number[]>([])
const params = useParams()
Expand Down Expand Up @@ -54,6 +53,6 @@ const ArtistSongs = () => {
<ScrollPagination getData={getData} renderItems={renderItems} />
</div>
)
}
})

export default ArtistSongs
5 changes: 3 additions & 2 deletions packages/web/pages/Artist/ArtistVideos.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import { useParams } from 'react-router-dom'
import useArtistMV from '@/web/api/hooks/useArtistMV'
import { useTranslation } from 'react-i18next'
import uiStates from '@/web/states/uiStates'
import { memo } from 'react'

const ArtistVideos = () => {
const ArtistVideos = memo(() => {
const { t } = useTranslation()
const params = useParams()
const { data: videos } = useArtistMV({ id: Number(params.id) || 0 })
Expand Down Expand Up @@ -31,6 +32,6 @@ const ArtistVideos = () => {
</div>
</div>
)
}
})

export default ArtistVideos
7 changes: 0 additions & 7 deletions packages/web/pages/Browse/Browse.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
import Tabs from '@/web/components/Tabs'
import { fetchDailyRecommendPlaylists, fetchRecommendedPlaylists } from '@/web/api/playlist'
import { PlaylistApiNames } from '@/shared/api/Playlists'
import { useState } from 'react'
import { useQuery } from '@tanstack/react-query'
import CoverRowVirtual from '@/web/components/CoverRowVirtual'
import PageTransition from '@/web/components/PageTransition'
import { playerWidth, topbarHeight } from '@/web/utils/const'
import { cx, css } from '@emotion/css'
import CoverRow from '@/web/components/CoverRow'
import topbarBackground from '@/web/assets/images/topbar-background.png'
import Recommend from './Recommend'
import Top from './Top'
import Hot from './Hot'
Expand Down

0 comments on commit 80913e6

Please sign in to comment.