Skip to content

Commit 95ddbe4

Browse files
authored
Update as per @paroche's comments
1 parent 07ae558 commit 95ddbe4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

1-js/11-async/03-promise-chaining/article.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ fetch('/article/promise-chaining/user.json')
287287
});
288288
```
289289

290-
The code works; see comments about the details. However, there's a potential problem in it, a typical error of those who begin to use promises.
290+
The code works; see comments about the details. However, there's a potential problem in it, a typical error for those who begin to use promises.
291291

292292
Look at the line `(*)`: how can we do something *after* the avatar has finished showing and gets removed? For instance, we'd like to show a form for editing that user or something else. As of now, there's no way.
293293

@@ -321,7 +321,7 @@ fetch('/article/promise-chaining/user.json')
321321

322322
That is, the `.then` handler in line `(*)` now returns `new Promise`, that becomes settled only after the call of `resolve(githubUser)` in `setTimeout` `(**)`. The next `.then` in the chain will wait for that.
323323

324-
As a good practice, an asynchronous action should always return a promise. That makes it possible to plan actions after it. Even if we don't plan to extend the chain now, we may need it later.
324+
As a good practice, an asynchronous action should always return a promise. That makes it possible to plan actions after it; even if we don't plan to extend the chain now, we may need it later.
325325

326326
Finally, we can split the code into reusable functions:
327327

0 commit comments

Comments
 (0)