Skip to content

Is that correct the effect dependencies are not exhaustive #263

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

Closed
soulcm opened this issue Feb 15, 2020 · 3 comments
Closed

Is that correct the effect dependencies are not exhaustive #263

soulcm opened this issue Feb 15, 2020 · 3 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@soulcm
Copy link

soulcm commented Feb 15, 2020

In the use-swr file, I found some effect dependencies not exhaustive, I want to konw it is correct or not.

image
If add eslint-plugin-react-hooks, and add "react-hooks/exhaustive-deps": "warn" in your .eslintrc It will warn that React Hook useEffect has missing dependencies: 'config. suspense'

the same as below code

const revalidate = useCallback(() => {
  // ... 
if (fnArgs !== null) {
            CONCURRENT_PROMISES[key] = fn(...fnArgs)
          } else {
            CONCURRENT_PROMISES[key] = fn(key)
          }
// ...
}, [key]) // the  fn args also not add the dependencies

anybody could make sense for me is that conrrect or not. thanks a lot

@koba04
Copy link
Collaborator

koba04 commented Jan 12, 2021

I've created a PR to fix this.

@koba04
Copy link
Collaborator

koba04 commented Jan 19, 2021

This has been fixed via #886, so we could close this.

@huozhi
Copy link
Member

huozhi commented Jan 19, 2021

Close this as the warning has been disabled in latest commits. config.suspense is required to be static during the swr lifecycle.

@huozhi huozhi closed this as completed Jan 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants