dominant-strategies / quai-explorer

Quai Network frontend block explorer.
https://quaiscan.io
13 stars 10 forks source link

write subscriptions for the block and transactions table #54

Closed skunal8197 closed 2 years ago

skunal8197 commented 2 years ago

test with @DenisIvanov26

skunal8197 commented 2 years ago

relevant code

subscribeToMore({
      document: SUBSCRIBE_BLOCK_CHANGES,
      variables: { fetchPolicy: "cache-and-network", num: limit, offset: (currentPage - 1) * limit },
      updateQuery: (prev, { newData }) => {
        if (!newData) return prev;
        const newBlock = newData.blocks[0]
        return Object.assign({}, prev, {
          blocks: [newBlock, ...prev.blocks]
        });
      }
    })