You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi! I realized that queries are fired depending on the order they are provided to component.apollo, which is completely fine in most cases. However, when using apollo-link-state, it might be useful to run local queries earlier since they are synchronous (or seems to be).
I was fetching a todo list but had some filter applied to the query. This filter is a string and lives in apollo-link-state, so the component needs to get this filter as well. When order was apollo: { todos:{}, filter: {} }, I had 2 network requests for the todos: one without filter and another one with filter. When order is apollo: { filter:{}, todos: {} }, there is only 1 request directly with the filter applied.
Of course, this can be prevented by using skip and perhaps an additional flag or something. I just thought that it could be useful to write it here and either add this information to the docs or run local queries first.
Thanks!
The text was updated successfully, but these errors were encountered:
Hi! I realized that queries are fired depending on the order they are provided to
component.apollo
, which is completely fine in most cases. However, when usingapollo-link-state
, it might be useful to run local queries earlier since they are synchronous (or seems to be).I was fetching a todo list but had some filter applied to the query. This filter is a string and lives in
apollo-link-state
, so the component needs to get this filter as well. When order wasapollo: { todos:{}, filter: {} }
, I had 2 network requests for the todos: one without filter and another one with filter. When order isapollo: { filter:{}, todos: {} }
, there is only 1 request directly with the filter applied.Of course, this can be prevented by using
skip
and perhaps an additional flag or something. I just thought that it could be useful to write it here and either add this information to the docs or run local queries first.Thanks!
The text was updated successfully, but these errors were encountered: