Skip to content

Commit 90b3352

Browse files
committed
Screenshots and sandboxes for Parts 4 and 5
1 parent 6ad07fe commit 90b3352

File tree

8 files changed

+10
-10
lines changed

8 files changed

+10
-10
lines changed

docs/tutorials/essentials/part-4-using-data.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1474,8 +1474,8 @@ Here's what our app looks like after all these changes:
14741474
14751475
<iframe
14761476
class="codesandbox"
1477-
src="https://codesandbox.io/embed/github/reduxjs/redux-essentials-example-app/tree/checkpoint-2-reactionButtons/?codemirror=1&fontsize=14&hidenavigation=1&theme=dark&runonclick=1"
1478-
title="redux-essentials-example-app"
1477+
src="https://codesandbox.io/embed/github/reduxjs/redux-essentials-example-app/tree/2b5a8361da115296107975a59155bc52a040d0a1?fontsize=14&hidenavigation=1&module=%2fsrc%2Ffeatures%2Fposts%2FpostsSlice.ts&theme=dark&runonclick=1"
1478+
title="redux-essentials-example"
14791479
allow="geolocation; microphone; camera; midi; vr; accelerometer; gyroscope; payment; ambient-light-sensor; encrypted-media; usb"
14801480
sandbox="allow-modals allow-forms allow-popups allow-scripts allow-same-origin"
14811481
></iframe>

docs/tutorials/essentials/part-5-async-logic.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -563,19 +563,19 @@ export const PostsList = () => {
563563

564564
And with that, we should now see a fresh list of posts showing up after we log in to our app!
565565

566-
**[TODO] Lorem ipsum screenshot here**
566+
![List of fetched posts](/img/tutorials/essentials/posts-fetched.png)
567567

568568
#### Avoiding Duplicate Fetches
569569

570570
The good news is we've successfully fetched those post objects from our mock server API.
571571

572572
Unfortunately, we've got a problem. Right now our posts list is showing duplicates of each post:
573573

574-
**[TODO] Duplicate post screenshot here**
574+
![Duplicate post items](/img/tutorials/essentials/posts-duplicates.png)
575575

576576
In fact, if we look at the Redux DevTools, we can see _two_ sets of `'pending'` and `'fulfilled'` actions were dispatched:
577577

578-
**[TODO] Duplicate actions screenshot here**
578+
![Duplicate fetchPosts actions](/img/tutorials/essentials/devtools-posts-duplicate.png)
579579

580580
Why is that? Didn't we just add a check for `postStatus === 'idle'`? Shouldn't that be enough to make sure we only dispatch the thunk once?
581581

@@ -627,9 +627,11 @@ export const fetchPosts = createAppAsyncThunk(
627627

628628
Now when we reload the page and look at the `<PostsList>`, we should only see one set of posts, with no duplicates, and we should only see one set of dispatched actions in the Redux DevTools.
629629

630+
**You don't _need_ to add `condition` to all thunks**, but there may be times it's useful to ensure only one request gets made at a time.
631+
630632
:::tip
631633

632-
Note that RTK Query will manage this for you! It deduplicates requests across _all_ components, so that each request only happens once, and you don't have to worry about doing this yourself.
634+
Note that [RTK Query will manage this for you!](./part-7-rtk-query-basics.md) It deduplicates requests across _all_ components, so that each request only happens once, and you don't have to worry about doing this yourself.
633635

634636
:::
635637

@@ -883,8 +885,6 @@ Remember, **the `create` callback syntax is optional!** The only time you _have_
883885

884886
We're now fetching and displaying our list of posts. But, if we look at the posts, there's a problem: they all now say "Unknown author" as the authors:
885887

886-
**[TODO] Update screenshot here**
887-
888888
![Unknown post authors](/img/tutorials/essentials/posts-unknownAuthor.png)
889889

890890
This is because the post entries are being randomly generated by the fake API server, which also randomly generates a set of fake users every time we reload the page. We need to update our users slice to fetch those users when the application starts.
@@ -1108,8 +1108,8 @@ Here's what our app looks like now that we're fetching data from that fake API:
11081108

11091109
<iframe
11101110
class="codesandbox"
1111-
src="https://codesandbox.io/embed/github/reduxjs/redux-essentials-example-app/tree/checkpoint-3-postRequests/?codemirror=1&fontsize=14&hidenavigation=1&theme=dark&runonclick=1"
1112-
title="redux-essentials-example-app"
1111+
src="https://codesandbox.io/embed/github/reduxjs/redux-essentials-example-app/tree/58da61f83f6461e51e168a0d08c7fd7c9c9a5092?fontsize=14&hidenavigation=1&module=%2fsrc%2Ffeatures%2Fposts%2FpostsSlice.ts&theme=dark&runonclick=1"
1112+
title="redux-essentials-example"
11131113
allow="geolocation; microphone; camera; midi; vr; accelerometer; gyroscope; payment; ambient-light-sensor; encrypted-media; usb"
11141114
sandbox="allow-modals allow-forms allow-popups allow-scripts allow-same-origin"
11151115
></iframe>
24.6 KB
Loading
-3.41 KB
Loading
-1.95 KB
Loading
56.5 KB
Loading
39 KB
Loading
2.23 KB
Loading

0 commit comments

Comments
 (0)