Using selectors not creating subscriptions to endpoints. #4398
Unanswered
pgsandstrom
asked this question in
Q&A
Replies: 2 comments
-
the only way to create a subscription is to use the useQuery/useLazyQuery hooks. If you only need a portion of the data, use |
Beta Was this translation helpful? Give feedback.
0 replies
-
As Ben said, subscriptions are done by the hooks because there's more than just "select the data" - it needs to manage the subscription reference counting. The right approach is to use the appropriate query hook. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a few endpoints. Then I have some selectors that uses data from the endpoints. The real code is something similar to the examples below. What I expected was that if a component uses the selectors, it should subscribe to the endpoint in the same way as if I used the hook from the endpoint. But this isnt the case.
So my question is, what is an appropriate pattern to solve this? Should I construct hooks that wraps the selectors and also calls all the used endpoint-hooks, to ensure subscription? Im currently migrating a huge application to modern redux, so "not using selectors like this" unfortunately isnt an option right now.
selector:
And then in my component I have:
Beta Was this translation helpful? Give feedback.
All reactions