Skip to content

Commit

Permalink
Refactor recents in RecentSubjectsContainer
Browse files Browse the repository at this point in the history
  • Loading branch information
mcbouslog committed Jun 14, 2024
1 parent 684a196 commit b8ad896
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,8 @@ function RecentSubjectsContainer({ authUser }) {
name: 'user-recent-classifications',
userId: authUser.id
}
const { data, isLoading: recentsLoading, error: recentsError } = useSWR(cacheKey, fetchUserRecents, SWROptions)
const { data: recents, isLoading: recentsLoading, error: recentsError } = useSWR(cacheKey, fetchUserRecents, SWROptions)

// We only display 10 in the UI, so only fetch project data for the first 10 recents
const recents = data?.slice(0, 10)
const recentProjectIds = [...new Set(recents?.map(recent => recent.links?.project))]

const { data: projects, isLoading: projectsLoading, error: projectsError } = usePanoptesProjects(recentProjectIds)
Expand Down

0 comments on commit b8ad896

Please sign in to comment.