Skip to content

Implementation of infinite query #50

Answered by rayhantr
rayhantr asked this question in Q&A
Discussion options

You must be logged in to vote

This is my implementation of this whole process.

Get conversation query

export const GET_ALL_CONVERSATIONS_SUB = (offset?: number) => {
  const variables = { offset };
  const query = `
    subscription GET_ALL_CONVERSATIONS($offset: Int = 0) {
      payload: POC_conversations(limit: 10, order_by: {messages_aggregate: {max: {created_at: desc}}}, offset: $offset) {
        id
        created_at
        messages(limit: 1, order_by: {id: desc}) {
          id
          message
          message_type
          created_at
        }
      }
    }
  `;

  return { query, variables };
};

Get conversation count

export const GET_CONVERSATION_COUNT = () => {
  const query = `
    subscription G…

Replies: 2 comments 8 replies

Comment options

You must be logged in to vote
8 replies
@kaciakmaciak
Comment options

@rayhantr
Comment options

@kaciakmaciak
Comment options

@kaciakmaciak
Comment options

@rayhantr
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by rayhantr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants