Suggestion: add Optional varieties to useQuery
- Dominant language
- Rust
- Stars
- 19k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
I'm not sure if this is 'supported/intended' behaviour, but QueryRenderer allows you to pass an undefined query prop. If no query prop is supplied, then no data is fetched.
This is useful for some components which only need to fetch data under certain circumstances.
The new experimental hooks have no way of omitting the first argument.
I suggest introducing optional varieties of the use LazyLoad / Preloaded Queries that allow the conditional fetching of data.
Contributor guide
Research direction
Start by comparing QueryRenderer's handling of an omitted query prop with the experimental use LazyLoad and Preloaded Queries hooks. Determine the intended API for optional query arguments and how conditional fetching should behave. Done means the hooks support omitted queries in the proposed optional varieties while preserving existing behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, javascript, react
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100