Skip to content

Commit

Permalink
chore: Restore name of terminating Apollo link to httpLink (redwoodjs…
Browse files Browse the repository at this point in the history
  • Loading branch information
dthyresson authored Oct 16, 2023
1 parent 1ed2b5b commit 43efb0f
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions packages/web/src/apollo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export type RedwoodApolloLinkName =
| 'withToken'
| 'authMiddleware'
| 'updateDataApolloLink'
| 'terminatingLink'
| 'httpLink'

export type RedwoodApolloLink<
Name extends RedwoodApolloLinkName,
Expand All @@ -72,10 +72,7 @@ export type RedwoodApolloLinks = [
RedwoodApolloLink<'withToken'>,
RedwoodApolloLink<'authMiddleware'>,
RedwoodApolloLink<'updateDataApolloLink'>,
RedwoodApolloLink<
'terminatingLink',
apolloClient.ApolloLink | apolloClient.HttpLink
>
RedwoodApolloLink<'httpLink', apolloClient.ApolloLink | apolloClient.HttpLink>
]

export type RedwoodApolloLinkFactory = (
Expand Down Expand Up @@ -215,7 +212,7 @@ const ApolloProviderWithFetchConfig: React.FunctionComponent<{

// Our terminating link needs to be smart enough to handle subscriptions, and if the GraphQL query
// is subscription it needs to use the SSELink (server sent events link).
const terminatingLink = apolloClient.split(
const httpOrSSELink = apolloClient.split(
({ query }) => {
const definition = getMainDefinition(query)

Expand All @@ -238,7 +235,7 @@ const ApolloProviderWithFetchConfig: React.FunctionComponent<{
{ name: 'withToken', link: withToken },
{ name: 'authMiddleware', link: authMiddleware },
{ name: 'updateDataApolloLink', link: updateDataApolloLink },
{ name: 'terminatingLink', link: terminatingLink },
{ name: 'httpLink', link: httpOrSSELink },
]

let link = redwoodApolloLink
Expand Down

0 comments on commit 43efb0f

Please sign in to comment.