Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

useBaseQuery - non-reactive useEffect dependencies? #6246

Closed
AjaxSolutions opened this issue May 6, 2020 · 2 comments
Closed

useBaseQuery - non-reactive useEffect dependencies? #6246

AjaxSolutions opened this issue May 6, 2020 · 2 comments

Comments

@AjaxSolutions
Copy link

AjaxSolutions commented May 6, 2020

https://github.com/apollographql/apollo-client/blob/master/src/react/hooks/utils/useBaseQuery.ts#L89

Is this dep list correct?

  useEffect(() => queryData.afterExecute({ lazy }), [
    queryResult.loading,
    queryResult.networkStatus,
    queryResult.error,
    queryResult.data,
  ]);

facebook/react#16121

"Dependencies should only include values that participate in top-down React data flow. Such as props, state, and what you calculate from them. "

@AjaxSolutions AjaxSolutions changed the title useBaseQuery useBaseQuery - non-reactive useEffect dependencies? May 6, 2020
@AjaxSolutions
Copy link
Author

I'm looking at React code checking deps in areHookInputsEqual. I don't see anything here that would favor React state or props. They just use Object.is polyfill to compare deps.

https://github.com/facebook/react/blob/e71f5df9c32b3b486bf4efce861834389c395d47/packages/react-dom/src/server/ReactPartialRendererHooks.js#L124

@hwillson
Copy link
Member

The dependency tracking we have in place is intentional and we would like to keep it as is for now. If you notice any issues caused because of this, definitely let us know. Thanks!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants