Skip to content

setQueryData slow with large data sets #1633

Closed
@andrewnaeve

Description

@andrewnaeve

Describe the bug
This may be a performance question, or maybe I need a paradigm shift.

I have a large query that comes back with several mb worth of data, for a table that gets frequently sorted. When I sort the data, and call queryClient.setQueryData() with the new sorted rows, it takes around half a second to complete. I've tried to break the data out into React state, and when I do that, it sorts in 10ms- but getting React state to sync nicely with React Query is challenging.

In my profiler, I see quite a bit of time being taken by "replaceEqualDeep".

I'm wondering if I'm using react-query incorrectly. Should I be replacing the cached query data like this? Are there any better strategies for large datasets?

Screenshots
calltree

Desktop (please complete the following information):

  • MacOS, latest FIrefox and Chrome
  • "react-query": "^3.5.5"

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