Caveats with passing the load-fetch into script for SSR?
#7034
Unanswered
MoritzKronberger
asked this question in
Q&A
Replies: 1 comment 3 replies
-
|
Hi Moritz, Sorry, I think I am misunderstanding something. Is there an error if you use a normal |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
A bit of background:
I am using SvelteKit with tRPC and Svelte Query and I am trying to get credentialized server-side requests to work. Svelte Query's
useQuerymust strictly be used on component initialization so I can't use the usual approach of running the queries inside thefetchfunction.The workaround I found, has been to instantiate the tRPC client using the
loadfunction'sfetchin my root-+layout.tsand accessing the client from thePageDataprop in my pages.My question:
Since the
loadfunction'sfetchis not available inside the page's/layout'sscriptby default (please correct me if this is wrong), I was wondering if there are any potential issues/concerns with passingfetchinto the pagescript?Beta Was this translation helpful? Give feedback.
All reactions