Skip to content

Commit

Permalink
fix(trends): placeholder data only if same source
Browse files Browse the repository at this point in the history
  • Loading branch information
ahonestla committed Jan 31, 2025
1 parent 67a21f8 commit e965646
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions client/src/pages/trends/components/ranking/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ function TrendsRankingItems() {
return (
<Container fluid>
<div className="fr-accordions-group">
{items.map((item, index) => (
<TrendsRankingItem key={`${index}-${includes}`} item={item} />
{items.map((item) => (
<TrendsRankingItem key={item.id} item={item} />
))}
</div>
{isFetching && <BaseSkeleton height="500px" />}
Expand Down
3 changes: 2 additions & 1 deletion client/src/pages/trends/hooks/useTrends.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ export default function useTrends() {
normalized: normalized,
includes: includes,
}),
placeholderData: (prev) => prev,
placeholderData: (previousData, previousQuery) =>
previousQuery?.queryKey && previousQuery.queryKey[1] === currentSource ? previousData : undefined,
})

const values = useMemo(() => {
Expand Down

0 comments on commit e965646

Please sign in to comment.