Skip to content

Commit 7785cfb

Browse files
committed
remove in-browser devtools, redux-thunk
1 parent 9feba95 commit 7785cfb

File tree

11 files changed

+33
-271
lines changed

11 files changed

+33
-271
lines changed

examples/real-world/package-lock.json

Lines changed: 0 additions & 175 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/real-world/package.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
"private": true,
55
"devDependencies": {
66
"react-scripts": "^4.0.0",
7-
"redux-devtools": "^3.7.0",
8-
"redux-devtools-dock-monitor": "^1.2.0",
9-
"redux-devtools-log-monitor": "^2.1.0",
107
"redux-logger": "^3.0.6"
118
},
129
"dependencies": {
@@ -18,8 +15,7 @@
1815
"react-dom": "^17.0.1",
1916
"react-redux": "^7.2.1",
2017
"react-router-dom": "^5.2.0",
21-
"redux": "^4.0.5",
22-
"redux-thunk": "^2.3.0"
18+
"redux": "^4.0.5"
2319
},
2420
"scripts": {
2521
"start": "react-scripts start",

examples/real-world/src/actions/index.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ export const loadUser = createAsyncThunk(
1515
}
1616
},
1717
{
18-
// If the user is already cached, this thunk will not dispatch anything.
1918
condition: ({ login, requiredFields }, { getState }) => {
2019
const user = getState().entities.users[login]
20+
// If the user is already cached, nothing will be requested or dispatched
2121
const shouldProceed = !(
2222
user && requiredFields.every(key => user.hasOwnProperty(key))
2323
)
@@ -40,9 +40,9 @@ export const loadRepo = createAsyncThunk(
4040
}
4141
},
4242
{
43-
// If the user is repo cached, this thunk will not dispatch anything.
4443
condition: ({ fullName, requiredFields }, { getState }) => {
4544
const repo = getState().entities.repos[fullName]
45+
// If the repo is cached, nothing will be requested or dispatched
4646
const shouldProceed = !(
4747
repo && requiredFields.every(key => repo.hasOwnProperty(key))
4848
)
@@ -51,8 +51,9 @@ export const loadRepo = createAsyncThunk(
5151
}
5252
)
5353

54-
// Fetches a page of starred repos by a particular user.
55-
// Bails out if page is cached and user didn't specifically request next page.
54+
/**
55+
* Fetches a page of starred repos by a particular user.
56+
*/
5657
export const loadStarred = createAsyncThunk(
5758
'loadStarred',
5859
async ({ login }, { rejectWithValue, getState }) => {
@@ -66,9 +67,9 @@ export const loadStarred = createAsyncThunk(
6667
}
6768
},
6869
{
69-
// If the user is repo cached, this thunk will not dispatch anything.
7070
condition: ({ login, nextPage }, { getState }) => {
7171
const { pageCount = 0 } = getState().pagination.starredByUser[login] || {}
72+
// Bails out if page is cached and user didn't specifically request next page.
7273
const shouldProceed = !(pageCount > 0 && !nextPage)
7374
return shouldProceed
7475
}
@@ -77,8 +78,6 @@ export const loadStarred = createAsyncThunk(
7778

7879
/**
7980
* Fetches a page of stargazers for a particular repo.
80-
* Bails out if page is cached and user didn't specifically request next page.
81-
* Relies on Redux Thunk middleware.
8281
*/
8382
export const loadStargazers = createAsyncThunk(
8483
'loadStargazers',
@@ -93,10 +92,10 @@ export const loadStargazers = createAsyncThunk(
9392
}
9493
},
9594
{
96-
// If the user is repo cached, this thunk will not dispatch anything.
9795
condition: ({ nextPage, fullName }, { getState }) => {
9896
const { pageCount = 0 } =
9997
getState().pagination.stargazersByRepo[fullName] || {}
98+
// Bails out if page is cached and user didn't specifically request next page.
10099
const shouldProceed = !(pageCount > 0 && !nextPage)
101100
return shouldProceed
102101
}

examples/real-world/src/components/Explore.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ const Explore = ({ onChange, value }) => {
1313
onChange(inputRef.current.value)
1414
}
1515

16-
const handleKeyUp = e => {
17-
if (e.keyCode === 13) {
16+
const handleKeyPress = e => {
17+
if (e.key === 'Enter') {
1818
handleGoClick()
1919
}
2020
}
@@ -26,7 +26,7 @@ const Explore = ({ onChange, value }) => {
2626
size="45"
2727
ref={inputRef}
2828
defaultValue={value}
29-
onKeyUp={handleKeyUp}
29+
onKeyUp={handleKeyPress}
3030
/>
3131
<button onClick={handleGoClick}>Go!</button>
3232
<p>

examples/real-world/src/containers/DevTools.js

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)