-
-
Notifications
You must be signed in to change notification settings - Fork 452
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement server-side rendering support #261
Merged
Merged
Conversation
This file contains 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
This accepts a Wonka source and throws a promise if the result is not resolving immediately. This is done for suspensen and will also limit the source to a single result. If the source pushes a value synchronously it is let through and won't throw a promise, which also will subsequently let through more values from the source.
This can be used on the client and the server; On the server it can start caching results, while on the client it retrieves cached results from a rehydrated cache.
kitten
force-pushed
the
feat/suspense-promises
branch
from
June 5, 2019 15:14
85f942d
to
654bef9
Compare
Edit: nevermind, it's fixed |
This was a whoopsie.. The order of cachedOps$ and forwardedOps$ in ssrExchange is now reversed. It has been completely swapped to indicate that the order is important, but only the reverse merge matters. Essentially on the client we would delete the result from the cache in cachedOps$ but then check for whether it was cached again in forwardedOps$. This would unfortunately duplicate the operation.
jevakallio
reviewed
Jun 6, 2019
jevakallio
reviewed
Jun 6, 2019
Will potentially be retroactively reviewed again |
Works nicely. I'll keep testing |
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.
Fix #218
Server-side rendering can now be achieved; an app using
urql
can do this with just minor modifications. Instead of usinggetDataFromTree
likereact-apollo
does we're using our more genericreact-ssr-prepass
library.This still needs to be documented but essentially on the server the client used like so:
And on the client we also use the SSR exchange to rehydrate the data: