-
-
Notifications
You must be signed in to change notification settings - Fork 95
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
A couple typos in new client plugins doc #874
Conversation
|
@rmarscher is attempting to deploy a commit to the HoudiniGraphQL Team on Vercel. A member of the Team first needs to authorize it. |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
oh nice! thanks for fixing those 👍 |
Im curious to hear more about your experience with the client plugins! As far as I know, you're the first to write one that isn't me so any feedback on docs, mental model, etc would be huge 🙌 |
I love the client plugins. The model makes sense to me. I like the composability options and it was pretty simple to port what we were doing pre-1.0 to a client plugin. We're using it for two things now:
Here's the network plugin: async network(ctx, { resolve }) {
let result: Response;
// Ability for server-side queries to pass an alternate fetch
if (ctx.metadata?.['fetch']) {
const _fetch = ctx.metadata['fetch'] as typeof fetch;
result = await _fetch(ctx.text, ctx.variables);
} else {
const options: RequestInit = {
method: 'POST',
credentials: 'include',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
query: ctx.text,
variables: ctx.variables,
}),
};
result = await ctx.fetch('/graphql', options);
}
const clonedResult = result.clone();
try {
resolve(ctx, await result.json());
} catch (e) {
console.log('Problem parsing result json: ', await clonedResult.text());
throw e;
}
}, And here's the custom fetch which we import in *.server.ts files and pass in our houdini fetch and mutate calls.
|
Sorry that wasn't really any useful feedback. Just praise :-) |
Oh don't worry - praise is fine too 😅 I'm super happy to hear you had an easy time adapting to the new world. I was mostly concerned about the overall complexity of having multiple phases, rules, terms, etc. but it sounds like you were able to navigate it well. Thanks for the feedback! |
I noticed these while following the 1.0 migration docs and migrating our custom client fetch to a network plugin. Thanks!