MCPcopy Create free account
hub / github.com/apollographql/fullstack-tutorial / update

Function update

final/client/src/containers/action-button.tsx:36–53  ·  view source on GitHub ↗
(cache, { data: { cancelTrip } })

Source from the content-addressed store, hash-verified

34 {
35 variables: { launchId: id },
36 update(cache, { data: { cancelTrip } }) {
37 // Update the user's cached list of trips to remove the trip that
38 // was just canceled.
39 const launch = cancelTrip.launches[0];
40 cache.modify({
41 id: cache.identify({
42 __typename: 'User',
43 id: localStorage.getItem('userId'),
44 }),
45 fields: {
46 trips(existingTrips: Reference[], { readField }) {
47 return existingTrips.filter(
48 tripRef => readField("id", tripRef) !== launch.id
49 );
50 }
51 }
52 });
53 }
54 }
55 );
56

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected