chore: add new standardized fetcher #11174
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds a new
createFetcherfunction that's exposed fromuseApiGetter.Much like in #6541, I'm tired of having to manually redeclare the fetcher in each and every fetching hook, especially when it's always the exact same. As such, I'd like to create a shared standard.
... But that didn't work the last time. Presumably because existing uses weren't updated. I'd suggest that if we do this, then we should update all existing hooks so that the next time someone copies an existing fetch hook, they get the new fetcher instead of the old one.
Additionally, this
createFetcherfunction has two improvements on the existingfetcherfunction:fetcherfunction, we use it as() => fetcher(args). If it's always gonna be a function, why don't we just do that directly?Follow-up work:
Replace all existing usages of
const fetcher =and the otherfetcherfunction, such that we can standardize this.