-
I'm using But the problem is: when I change a filter, the So when I had the first filter applied and I change the second filter, the list changes weirdly without loading component. Example: 2 (list with first filter) -> 1 (fallback) -> 3 (new list after fetch) Do I need to handle this myself with the Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
I just found out I can't use |
Beta Was this translation helpful? Give feedback.
-
To share how I did it, I decided to apply a temporary workaround that only provides initialData when in server side rendering. initialData: characters && typeof window === 'undefined' ? { pages: [characters], pageParams: [1] } : undefined, But I would really like to see a better solution without having to implement it myself. |
Beta Was this translation helpful? Give feedback.
-
I was thinking about the case and found that initialData was being provided even though the queryKey had changed when I modified the filters. It was confusing because initialData was being provided from custom hook, and I haven’t thought about it hours ago. export function useCharacterRanking (
{
// ...
...options
}: UseInfiniteQueryOptions<RankedCharacter[]> = {}
) {
return useInfiniteQuery<RankedCharacter[]>(
// ...,
// ...,
options
)
} useCharacterRanking({
// ...
initialData: rankingData
}) |
Beta Was this translation helpful? Give feedback.
I was thinking about the case and found that initialData was being provided even though the queryKey had changed when I modified the filters. It was confusing because initialData was being provided from custom hook, and I haven’t thought about it hours ago.