Skip to content

Questions regarding the transportValues #30

@eknkc

Description

@eknkc

Hi,

I've been looking at the code and doing some experiments myself. While I do not have an issue, I'd like to learn about some details (sorry if I missed something in the code thoguh, not really familiar with the apollo internals);

  • Why do we need useTransportValue and keeping track of hook returns? It looks like as long as the cache is populated, on the client side, the return values will be consistent with the server. Is this for cases like a useSuspendQuery running first, populating some cache and useQuery somewhere else running the same query?
  • It looks like due to transportedValues and the incomingResults will duplicate almost every result. Any chance to avoid this?
  • How would this behave if there are more than one provider on the page? transportedValues have useId keys so they should be fine but incomingResults would not work (I assume). Any chance to keep track of multiple ApolloRehydrationContext instances also using useId or something like that? I guess useRehydrationContext could also receive an id parameter from useTransportValue and only restore the cache entries belonging to that id? That should also solve the keeping track of transportValues I guess? Cache would be consistent with whatever happened on server if each useTransportValue call would restore specific cache belonging to that id.

Also, the beta client exports useSuspenseQuery without _experimental suffix now.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions