question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Suggestion: overload `useSubscription` to add support for observer objects

See original GitHub issue

The subscribe function of an Observable can receive an observer object:

const observer = { next: myNext, error: myError, complete: myComplete }

ob$.subscribe(observer)

It would be great if useSubscription allowed the same, so we can do this:

useSubscription(ob$, observer)

… instead of this:

useSubscription(ob$, observer.next, observer.error, observer.complete)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
OliverJAshcommented, Aug 27, 2020

I’ll raise a PR.

Thanks for the fantastic lib btw. Migrating the Unsplash app over from rxjs-hooks, this is much more flexible.

0reactions
OliverJAshcommented, Dec 9, 2020

Hey I haven’t had the chance sorry, I still really want it though!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Suggestion: overload `useSubscription` to add support for observer ...
5 Answer: Hi, we purposely did not support the observer object for performance reason. It would create less garbage and easier to handle...
Read more >
Subscriptions - Apollo GraphQL Docs
Like useQuery , useSubscription returns an object from Apollo Client that contains loading , error , and data properties you can use to...
Read more >
Observables compared to other techniques - Angular
Observable subscriptions are cancellable. Unsubscribing removes the listener from receiving further values, and notifies the subscriber function to cancel work.
Read more >
HANFORD JOINT UNION HIGH SCHOOL DISTRICT BOARD OF ...
Kings County Office of Education- Universal Design for Learning Support for ... Our schools include many areas for student daily activities including ...
Read more >
GraphQL subscriptions - Relay
Note that subscriptions can also reference GraphQL variables in the same way queries or fragments do. Using useSubscription to create a subscription​. In...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found