Skip to content

Helpers to prefetch data  #91

@nopitown

Description

@nopitown

Is your feature request related to a problem? Please describe.
Currently, I'm prefetching data in a server component so it can later be used in a client component. But creating the code is a manual process that could be easier if we have helpers (similar to the hooks).

Describe the solution you'd like

It would be nice to have something like:

await useFooServiceFindOnePrefetch(//...keys); // or await prefetchFooServiceFindOne(//...keys)

Instead of building it from scratch:

  await queryClient.prefetchQuery({
    queryKey: [
      useFooServiceFindOnePrefetchKey,
     // more keys
    ],
    queryFn: () => {
      return FooService.findOne(//...keys);
    },
  });

Any chance to consider this?
Describe alternatives you've considered
N/A

Additional context
I'm prefetching data using the guidelines from here

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions