Repository navigation
feat(httpBatchLink): alternative DX streamRequester for batch streaming - #4403
Merged
Sheraff merged 7 commits intoMay 25, 2023
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git βοΈ
|
12 tasks done
β¦r-batch-response-alternative-dx
Sheraff
marked this pull request as ready for review
May 22, 2023 10:26
KATT
reviewed
May 23, 2023
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Proposal for #4347
π° Update
The
requesteroption proposal was rejected, but this PR is still better for code-sharing between regular batch link and stream batch link, so I used it as a base to refactor into 2 separate linkshttpBatchLinkandunstable_httpBatchStreamLinkthat share most of their code. This still allows for DRY and tree-shakeable code.π― Changes
Avoid duplicating
httpBatchLinklogic intohttpBatchStreamLinkby simply allowing for the single part that is different (thefetchmethod) to be passed as an option in the instantiation of the link.Allows for
The new option is called
requesterand defaults to the "normal"batchRequester:Another possibility (though not what is implemented here) would be to have a
loaderoption (instead of therequesteroption) which would include thevalidatemethod in addition to thefetchmethod. While it's not required in this case, it might be a good way to future-proof this option.β Checklist