-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
PR closed due to unresolved review loop #8021
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
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
I don't see how this is an improvement to our previous page |
@avivkeller Let me explain why these changes are improvements. Each commit addresses a concrete issue in the examples or improves clarity where it previously led to confusion:
|
You can use code tabs for CJS/ESM |
Am I mistaken, or there are no code tabs to switch between CJS and ESM in the fetch documentation?: ![]() This is the code I'm changing, the default one will give SyntaxError: ![]() |
Hello everyone! I'm going to update the fetch.md file so that it contains tabs for both CJS and ESM, keeping the rest changes as it is. This will not take much! |
Update: Added missing dual tab support (CommonJS and ES Modules) for the streaming examples in fetch documentation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGMT !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still doing several things. For example, If we want to add CJS/ESM interop, it should be it's own PR.
Let's do the fixes in one PR, and the addition/features in another |
@avivkeller Acknowledged, working on it! |
…voiding parsing incomplete chunks mid-stream
Signed-off-by: Nitin <nitinjha2609@gmail.com>
Tab changes were reverted, it will be submitted separately in another PR. This one now only includes small fixes and clarification changes to the fetch example. Changes were made on top of the latest main branch. |
Tab additions have been separated out into a new PR (#8035) to keep changes focused. That PR builds on top of the updates made here. In case any conflicts occur, then I'm happy to rebase the branch of that PR (fetch-tabs) on top of main once this PR is merged, tag me anytime! |
Hey @avivkeller @AugustinMauroy 👋 |
@@ -181,4 +181,4 @@ async function fetchGitHubRepos() { | |||
} | |||
|
|||
fetchGitHubRepos().catch(console.error); | |||
``` | |||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
``` | |
``` | |
} catch (error) { | ||
console.error('Error parsing JSON:', error); | ||
} finally { | ||
console.log('Stream processing completed.'); | ||
callback(); | ||
} | ||
|
||
callback(); | ||
}, | ||
final(callback) { | ||
console.log('Stream processing completed.'); | ||
callback(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The point of this demo is to showcase the callback, let's not change it to a try final
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree with aviv here - sometimes we choose to show code concepts in isolation even if a production app would have far more rigor
@@ -155,23 +157,21 @@ async function fetchGitHubRepos() { | |||
return new Writable({ | |||
write(chunk, encoding, callback) { | |||
buffer += chunk.toString(); | |||
|
|||
callback(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this added?
partial += decoder.decode(chunk, { stream: true }); | ||
// Note: decoder.decode() with { stream: true } may buffer incomplete UTF-8 chunks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this relevant to the code snippet?
- comments go above the block
@avivkeller Alright, I’ve already explained everything above and responded to all the points, but it’s starting to feel it’s just going in circles or not really being read. So I’m gonna close this PR, along with the other one that depended on it. |
i hope you find ways to continue contributing, I felt as if review feedback was responsive here. |
Description
This PR improves the fetch.md documentation by fixing and clarifying key code examples related to streaming, async usage, and response handling. These are the changes I made:
Related Issues
N/A
Check List