Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ...
- const subscribeToNewChats = () => {
- chatsQuery.subscribeToMore({
- document: gql`
- subscription MessageSentSubscription {
- messageSent {
- id
- content
- from
- createdAt
- }
- }
- `,
- updateQuery: (previousData, { subscriptionData }) => {
- return {
- chats: [
- subscriptionData.data.messageSent,
- ...previousData.chats
- ].splice(0, 8)
- };
- }
- });
- };
- // ...
Add Comment
Please, Sign In to add comment