Skip to content

Prefetching in 1.0 #195

@MarceloAlves

Description

@MarceloAlves

I've built a feature where a user can select an item and then the previous/next items are prefetched for later use when staleTime is set.

In 0.4, an item is selected, two prefetch queries and the item query are fired off and cached. Then when a user selects the next item, cached data is loaded and the next item is prefetched. The previous item isn't prefetched since it already exists in the cache.

In 1.0, an item is selected, two prefetch queries and the item query happen but selecting the next item will trigger another item query for the new selected item and also the prefetch for the previous/next items.

I'm not quite sure if this is how it should work or if I'm doing something wrong but any guidance would be very helpful.

I've created two sandboxes with the different versions:

0.4.3 - https://codesandbox.io/s/clever-wilson-mtzph
1.0.10 - https://codesandbox.io/s/amazing-kare-zlnwp

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions