skip to content

Apollo

Apollo Client is the full-featured GraphQL client: declarative queries and mutations, a normalized cache, fragments, subscriptions, and a configurable link chain. Its cache is both what makes it powerful and what interview questions concentrate on.

on this pageshow

explore

questions

page 2 of 2

In Apollo Client 4, an isInCart @client field computed by a LocalState resolver shows stale values after the cart changes, while a read-function version stays current; why?

level: seniorimportance: nice to knowfreq 16%

basics

~20 s

A LocalState resolver runs when the operation executes, and its output is cached with the server result, so cache-first reads return the stored value. A read function computes the field on read and tracks the reactive variables it reads.

open as a page

Upgrading an issue-detail component from Apollo Client 3 to 4, what must change in a useQuery call that imports from @apollo/client and uses skip and onCompleted?

level: seniorimportance: nice to knowfreq 24%

basics

~20 s

In Apollo Client 4, import useQuery from @apollo/client/react and move onCompleted logic into render or an effect on data, because query hooks lost that callback. Replace skip with skipToken, deprecated since 4.3, and expect loading during refetch.

open as a page

When would you run Apollo Client 4 subscriptions as multipart HTTP through HttpLink instead of a GraphQLWsLink WebSocket, and what does it cost?

level: seniorimportance: nice to knowfreq 12%

basics

~20 s

When the server supports multipart subscriptions, HttpLink streams them with no extra library, split or connectionParams, reusing the HTTP auth headers. The cost is one long-lived HTTP response per subscription, a one-way channel, and a server that must implement the protocol.

open as a page

showing 31–33 of 33