Skip to content

Conversation

@schiller-manuel
Copy link

Summary

This change allows to optionally provide the storage that is used in the ssr exchange for storing the serialized results.

Detailed description

The goal is to enable streaming SSR with @tanstack/start.
When it is possible to pass in a custom storage into the ssr exchange, a proxy can be passed in.
This can be used on the server to stream the serialized results to the client as soon as they are available, as well as retrieve them on the client.

A demo implementation is available here: https://github.com/schiller-manuel/start-urql/blob/main/app/router.tsx#L17

@changeset-bot
Copy link

changeset-bot bot commented Jan 2, 2025

🦋 Changeset detected

Latest commit: 24a6089

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@urql/core Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

const staleWhileRevalidate = !!params.staleWhileRevalidate;
const includeExtensions = !!params.includeExtensions;
const data: Record<string, SerializedResult | null> = {};
const data: SSRDataStorage =
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why can't we do this with initialState? For instance when we run extractData we extract into this custom storage and on the client we can leverage the restoreData method and initialState to restore additional and the initial entries.

This is similar to our nextjs solution

@schiller-manuel
Copy link
Author

closed in favor of #3729

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants