Skip to content

Correct mental model of new merge option, with serializeQueryArgs and forceRefetch #2966

@einarq

Description

@einarq

I think I'm struggling a bit to get the correct mental model of how I'm supposed to use the new options in queries to support loading more etc.

I'll try to explain the scenario first:

  • I have a getPermissions endpoint, which takes several parameters ({surveyId: string, filter: string, orderBy: string, orderDir: string, skip: number})
  • There is a Load More button on the list, which should load more and merge the responses. When the skip parameter changes, we want to load more results and merge the options.
  • I only want to merge the responses the skip param was changed but everything else was kept the same. If more params change, we should discard the cache and get new results.

Am I correct that the logic for this needs to live in the forceRefetch handler? Will the merge handler only get called if the forceRefetch option returns true? Seems to me that the merge handler could use some more information about next and previous args etc, but as I said I probably have the wrong mental model. I guess I need to understand more about the intention of the forceRefetch handler especially (the other two seem more obvious).

Are there any more complex examples I could look at than the one found in the release notes?

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