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

Fetch is called in spite of conditional variables are undefined #355

Open
fkrafi opened this issue Nov 4, 2021 · 1 comment
Open

Fetch is called in spite of conditional variables are undefined #355

fkrafi opened this issue Nov 4, 2021 · 1 comment

Comments

@fkrafi
Copy link

fkrafi commented Nov 4, 2021

Describe the bug
Fetch is called in spite of conditional variable value is undefined

⚠️ Make a Codesandbox ⚠️

const {data} = useFetch(`/api/product/${id}`, {}, [id]);

Expected behavior
Fetch shouldn't call the api when the conditional variables are undefined

@alex-cory
Copy link
Collaborator

alex-cory commented Nov 7, 2021

  1. you can just do useFetch(`api/product/${id}`, [id])
  2. this is a feature that would need to be implemented. I'm open to it. Submit a PR. I think the best way to do this would be to check if the dependency is undefined.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants