Leveraging paginated data in "item" page #785
-
In the Star Wars example the code queries the list of films when clicking on the Films page. Then when selecting a individual film the code doesn't use the existing data about the film from the list, it has to wait for query that is specific for that single film before the page is shown. How do you see best leveraging the data already loaded from the list to "pre-populate" the data for the single file page? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
Use initialData: () => queryCache.getQueryData("list").find((item) => item.id ===id) I came across the problem with pagination because each page has its own query key. |
Beta Was this translation helpful? Give feedback.
-
Seems like another option is to use <Link
component={RouterLink}
to={`/films/${filmId}`}
onClick={() => { queryCache.setQueryData(`film-${filmId}`, film); }}
> |
Beta Was this translation helpful? Give feedback.
-
How about this?
|
Beta Was this translation helpful? Give feedback.
How about this?