-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Some way to wait before send SSR results #2084
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
Comments
If you need to do asynchronous stuff that you want to have present in the SSR'd version of your site, that's what the |
If you haven't already, take a look at Houdini it's my goto with sveltekit and graphql, coming from a react/relay background. You may like it. Houdini |
@Conduitry correct me if I'm wrong, but if there's a That is my request, to be able to call something from inside after compiled - "I am ready to be ssr'd" Here is a example repo of how I fetch things, but it is not ssr friendly for this issue... |
Thanks for your suggestion, @pixelmund! I like Houdini a lot, and I appreciate your suggestion. Right now I'm trying to build a graphql client on top of a gqless, with the same principles as houdini and relay, but on a different api based on JS proxy... and I of course will try to open source it as it gets more polished. Hope houdini keeps the good work too. I think this is offtopic 😬 |
This, then, is essentially a Svelte feature request, and it's one that there's been an issue for for some time: sveltejs/svelte#958 This is impossible in SvelteKit without support in Svelte itself. In the meantime, having this async code live in |
Oh, okay! Thanks for clarifying. One last thing, may I somehow pass an object from svelte components in sync back to the Anyway, thanks for your thoughts, Conduitry! |
Describe the problem
I'm used to GraphQL Relay's concepts of data specification in a more declarative rather than imperative way. To achieve that, part of it is based on the principle of collocating data requirements next to where it is used. It makes an data intensive app more scalable as components become more modular, less coupled to pages, without over or underfetching.
Load
function is define what you need before you use. The methods I'm used to, you first use some data then it automatically request what you asked. I use gqless to achieve that. Rather than arguing which is better or has better performance, right now my workflow is not supported by svelte-kit.Describe the proposed solution
It would be highly appretiated to be able to wait for something inside my svelte components before sending the results, or be able to extract the cache of it. Something in which I could extract information of what was compiled (without needing to right an preprocessor), pass cache back after
await resolve(request)
atHandle
function inhooks.ts
.Routify does have an utility called
$ready()
which would be a good inspiration of api...https://routify.dev/docs/helpers#ready
Alternatives considered
Leave as is and declare not scope of svelte-kit.
Refactor my app or be happy with some skeleton loading inside my app. But that would be a huge problem for SEO...
Importance
use SvelteKit without it becomes harder
Additional Information
Well, I could use Sveltekit without it, but I'd need to refactor all my app for it. And for my workflow it wouldn't be an improvement in terms of scalability.
about collocation:
https://www.graphql.com/articles/best-practices-for-graphql-clients
The text was updated successfully, but these errors were encountered: