allow to provide underlying storage for ssr exchange#3728
Closed
schiller-manuel wants to merge 1 commit intourql-graphql:mainfrom
Closed
allow to provide underlying storage for ssr exchange#3728schiller-manuel wants to merge 1 commit intourql-graphql:mainfrom
schiller-manuel wants to merge 1 commit intourql-graphql:mainfrom
Conversation
aa3bffb to
24a6089
Compare
🦋 Changeset detectedLatest commit: 24a6089 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
JoviDeCroock
reviewed
Jan 3, 2025
| const staleWhileRevalidate = !!params.staleWhileRevalidate; | ||
| const includeExtensions = !!params.includeExtensions; | ||
| const data: Record<string, SerializedResult | null> = {}; | ||
| const data: SSRDataStorage = |
Collaborator
There was a problem hiding this comment.
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
Author
|
closed in favor of #3729 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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