Skip to content

Commit aa31c02

Browse files
committed
add optimistic UI
1 parent 859ceb4 commit aa31c02

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/App.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,18 @@ const Watch = ({
122122
? VIEWER_SUBSCRIPTIONS.UNSUBSCRIBED
123123
: VIEWER_SUBSCRIPTIONS.SUBSCRIBED,
124124
}}
125+
optimisticResponse={{
126+
updateSubscription: {
127+
__typename: 'Mutation',
128+
subscribable: {
129+
__typename: 'Repository',
130+
id,
131+
viewerSubscription: isWatch(viewerSubscription)
132+
? VIEWER_SUBSCRIPTIONS.UNSUBSCRIBED
133+
: VIEWER_SUBSCRIPTIONS.SUBSCRIBED,
134+
},
135+
},
136+
}}
125137
update={updateWatch}
126138
>
127139
{(updateSubscription, { data, loading, error }) => (

0 commit comments

Comments
 (0)