Skip to content

Commit

Permalink
More fixes for outbound variables (#1332)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlecAivazis authored Aug 2, 2024
1 parent f8410b7 commit 389de55
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/thick-chicken-impress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'houdini': patch
---

More fixes for outbound unused variables
3 changes: 3 additions & 0 deletions packages/houdini/src/runtime/client/documentStore.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1175,6 +1175,7 @@ export function createStore(
pipeline: createPluginHooks(plugins),
artifact: {
kind: ArtifactKind.Query,
stripVariables: [],
hash: '1234',
raw: 'RAW_TEXT',
name: 'TestArtifact',
Expand Down Expand Up @@ -1209,6 +1210,7 @@ export function createFragmentStore(
client,
pipeline: createPluginHooks(plugins),
artifact: {
stripVariables: [],
kind: ArtifactKind.Fragment,
hash: '1234',
raw: 'RAW_TEXT',
Expand Down Expand Up @@ -1244,6 +1246,7 @@ function createStoreMutation(
pipeline: createPluginHooks(plugins),
artifact: {
kind: ArtifactKind.Mutation,
stripVariables: [],
hash: '1234',
raw: 'RAW_TEXT',
name: 'TestArtifact_Mutation',
Expand Down
7 changes: 6 additions & 1 deletion packages/houdini/src/runtime/client/plugins/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ export const fetch = (target?: RequestHandler | string): ClientPlugin => {
name: ctx.name,
text: ctx.text,
hash: ctx.hash,
variables: marshalVariables(ctx),
variables: { ...marshalVariables(ctx) },
}

// before we move onto the next plugin, we need to strip the variables as they go through
for (const variable of ctx.artifact.stripVariables) {
delete fetchParams.variables[variable]
}

let fetchFn = defaultFetch(client.url, ctx.fetchParams)
Expand Down
7 changes: 0 additions & 7 deletions packages/houdini/src/runtime/client/plugins/fetchParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@ export const fetchParams: (fn?: FetchParamFn) => ClientPlugin =
(fn = () => ({})) =>
() => ({
start(ctx, { next, marshalVariables }) {
// before we move onto the next plugin, we need to strip the variables as they go through
if (ctx.variables) {
for (const variable of ctx.artifact.stripVariables) {
delete ctx.variables[variable]
}
}

next({
...ctx,
fetchParams: fn({
Expand Down

0 comments on commit 389de55

Please sign in to comment.