Skip to content
This repository was archived by the owner on Nov 20, 2020. It is now read-only.
This repository was archived by the owner on Nov 20, 2020. It is now read-only.

Support for subscribeToMore on query #120

Open
@Ejhfast

Description

@Ejhfast

Does the library support loading additional data from a subscription after a query is executed? Subscriptions are difficult to use efficiently without this functionality: https://www.apollographql.com/docs/react/data/subscriptions/#subscribetomore

To get around this I have been doing something like:

module Subscriber {
  [@react.component]
  let make = (~results) => {
    (subResults, _) = ApolloHooks.useSubscription(...);
    switch subResults {
      | Data(newResults) => <StatelessRenderer results=newResults />
      | _ => <StatelessRenderer results=results />
    }
  }
}

// parent component will query, then child will either pass data through 
// or re-render on subscription update
[@react.component]
let make = () => {
  (results, _) = ApolloHooks.useQuery(...);
  <Subscriber results=results />
}

But this has the major problem that each subscription push most contain all the data required to re-render a components, as opposed to an individual item to add, subtract, etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions