Skip to content

InvariantError with ApolloProvider when client should be set #10938

@callensm

Description

@callensm

Environment: Browser
Version: >=3.8.0-alpha.14

Using @apollo/client versioning 3.8.0-alpha.14+, I'm receiving this invariant error from the ApolloProvider context component claiming that the client is not available for use within my query hooks. I know this to not be true because the application does not even mount unless the client is set (see snippet below).

This error persists through to the current 3.8.0-beta.0 version as well.

Snippets

export function App() {
  const user = useAuthenticatedUser();
  if (!user) {
    return <Loading />;
  }

  const apolloClient = createApolloClient(user.jwt);

  return (
    <ApolloProvider client={apolloClient} suspenseCache={suspenseCache}>
          <div
            style={{
              display: "flex",
              flexDirection: "column",
              height: "100%",
            }}
          >
            <Router />
          </div>
    </ApolloProvider>
  );
}

Screenshots

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions