Skip to content

Commit 4686a3c

Browse files
committed
upgrade to React 19
1 parent 1488d83 commit 4686a3c

File tree

14 files changed

+4988
-2868
lines changed

14 files changed

+4988
-2868
lines changed

epicshop/package-lock.json

+2,556-1,609
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

epicshop/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
"test": "playwright test"
66
},
77
"dependencies": {
8-
"@epic-web/config": "^1.5.3",
8+
"@epic-web/config": "^1.16.3",
99
"@epic-web/workshop-app": "^5.9.0",
1010
"@epic-web/workshop-utils": "^5.9.0",
11-
"execa": "^8.0.1",
11+
"execa": "^9.5.1",
1212
"fs-extra": "^11.2.0"
1313
}
1414
}

epicshop/update-deps.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
set -e
22

3-
npx npm-check-updates --dep prod,dev --upgrade --root --reject react,react-dom
4-
cd epicshop && npx npm-check-updates --dep prod,dev --upgrade --root react,react-dom
3+
npx npm-check-updates --dep prod,dev --upgrade --root
4+
cd epicshop && npx npm-check-updates --dep prod,dev --upgrade --root
55
cd ..
66
rm -rf node_modules package-lock.json ./epicshop/package-lock.json ./epicshop/node_modules ./exercises/**/node_modules
77
npm install

exercises/02.raw-react/02.solution.nesting/index.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@ await testStep('"Hello World" is rendered to the DOM', async () => {
3333
expect(hello, 'Hello span not found').to.be.instanceOf(HTMLElement)
3434
expect(world, 'World span not found').to.be.instanceOf(HTMLElement)
3535

36-
expect(hello.textContent, 'hello text is not correct').to.equal('Hello')
37-
expect(world.textContent, 'world text is not correct').to.equal('World')
36+
expect(hello?.textContent, 'hello text is not correct').to.equal('Hello')
37+
expect(world?.textContent, 'world text is not correct').to.equal('World')
3838
})

exercises/02.raw-react/03.solution.deep-nesting/index.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ await testStep('Proper elements are rendered to the DOM', async () => {
3131

3232
const [greenEggs, ham] = ul!.querySelectorAll('li')
3333

34-
expect(greenEggs.textContent, 'green eggs text is not correct').to.equal(
34+
expect(greenEggs?.textContent, 'green eggs text is not correct').to.equal(
3535
'Green eggs',
3636
)
37-
expect(ham.textContent, 'ham text is not correct').to.equal('Ham')
37+
expect(ham?.textContent, 'ham text is not correct').to.equal('Ham')
3838
})

exercises/03.using-jsx/04.solution.nesting/content.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ await testStep('Proper elements are rendered to the DOM', async () => {
3232

3333
const [greenEggs, ham] = ul!.querySelectorAll('li')
3434

35-
expect(greenEggs.textContent, 'green eggs text is not correct').to.equal(
35+
expect(greenEggs?.textContent, 'green eggs text is not correct').to.equal(
3636
'Green eggs',
3737
)
38-
expect(ham.textContent, 'ham text is not correct').to.equal('Ham')
38+
expect(ham?.textContent, 'ham text is not correct').to.equal('Ham')
3939
})

exercises/03.using-jsx/05.solution.fragments/content.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ await testStep('Proper elements are rendered to the DOM', async () => {
2828

2929
const [greenEggs, ham] = ul!.querySelectorAll('li')
3030

31-
expect(greenEggs.textContent, 'green eggs text is not correct').to.equal(
31+
expect(greenEggs?.textContent, 'green eggs text is not correct').to.equal(
3232
'Green eggs',
3333
)
34-
expect(ham.textContent, 'ham text is not correct').to.equal('Ham')
34+
expect(ham?.textContent, 'ham text is not correct').to.equal('Ham')
3535
})

exercises/04.components/01.solution.function/content.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ await testStep('Proper elements are rendered to the DOM', async () => {
2121
const messages = Array.from(element.querySelectorAll('.message'))
2222
expect(messages, 'messages not found').to.have.length(2)
2323
const [helloMessage, goodbyeMessage] = messages
24-
expect(helloMessage.textContent).to.equal('Hello World')
25-
expect(goodbyeMessage.textContent).to.equal('Goodbye World')
24+
expect(helloMessage?.textContent).to.equal('Hello World')
25+
expect(goodbyeMessage?.textContent).to.equal('Goodbye World')
2626
})

exercises/04.components/02.solution.raw/content.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ await testStep('Proper elements are rendered to the DOM', async () => {
2121
const messages = Array.from(element.querySelectorAll('.message'))
2222
expect(messages, 'messages not found').to.have.length(2)
2323
const [helloMessage, goodbyeMessage] = messages
24-
expect(helloMessage.textContent).to.equal('Hello World')
25-
expect(goodbyeMessage.textContent).to.equal('Goodbye World')
24+
expect(helloMessage?.textContent).to.equal('Hello World')
25+
expect(goodbyeMessage?.textContent).to.equal('Goodbye World')
2626
})

exercises/04.components/03.solution.jsx/content.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ await testStep('Proper elements are rendered to the DOM', async () => {
2121
const messages = Array.from(element.querySelectorAll('.message'))
2222
expect(messages, 'messages not found').to.have.length(2)
2323
const [helloMessage, goodbyeMessage] = messages
24-
expect(helloMessage.textContent).to.equal('Hello World')
25-
expect(goodbyeMessage.textContent).to.equal('Goodbye World')
24+
expect(helloMessage?.textContent).to.equal('Hello World')
25+
expect(goodbyeMessage?.textContent).to.equal('Goodbye World')
2626
})

exercises/10.arrays/02.problem.focus-state/index.tsx

+5-3
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ function App() {
2121
function getChangeHandler(item: (typeof items)[number]) {
2222
return (event: React.ChangeEvent<HTMLInputElement>) => {
2323
const newValue = event.currentTarget.value
24-
setItems(allItems =>
25-
allItems.map(i => ({
24+
setItems((allItems) =>
25+
allItems.map((i) => ({
2626
...i,
2727
value: i.id === item.id ? newValue : i.value,
2828
})),
@@ -98,7 +98,7 @@ function App() {
9898
id="autoshuffle"
9999
type="checkbox"
100100
checked={autoShuffle}
101-
onChange={event => setAutoShuffle(event.target.checked)}
101+
onChange={(event) => setAutoShuffle(event.target.checked)}
102102
/>
103103
<label htmlFor="autoshuffle">Auto-shuffle inputs</label>
104104
</div>
@@ -119,7 +119,9 @@ function shuffle<ArrayType>(originalArray: Array<ArrayType>) {
119119
currentIndex -= 1
120120
// And swap it with the current element.
121121
temporaryValue = array[currentIndex]
122+
// @ts-expect-error
122123
array[currentIndex] = array[randomIndex]
124+
// @ts-expect-error
123125
array[randomIndex] = temporaryValue
124126
}
125127
return array

exercises/10.arrays/02.solution.focus-state/index.tsx

+5-3
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ function App() {
2121
function getChangeHandler(item: (typeof items)[number]) {
2222
return (event: React.ChangeEvent<HTMLInputElement>) => {
2323
const newValue = event.currentTarget.value
24-
setItems(allItems =>
25-
allItems.map(i => ({
24+
setItems((allItems) =>
25+
allItems.map((i) => ({
2626
...i,
2727
value: i.id === item.id ? newValue : i.value,
2828
})),
@@ -94,7 +94,7 @@ function App() {
9494
id="autoshuffle"
9595
type="checkbox"
9696
checked={autoShuffle}
97-
onChange={event => setAutoShuffle(event.target.checked)}
97+
onChange={(event) => setAutoShuffle(event.target.checked)}
9898
/>
9999
<label htmlFor="autoshuffle">Auto-shuffle inputs</label>
100100
</div>
@@ -115,7 +115,9 @@ function shuffle<ArrayType>(originalArray: Array<ArrayType>) {
115115
currentIndex -= 1
116116
// And swap it with the current element.
117117
temporaryValue = array[currentIndex]
118+
// @ts-expect-error
118119
array[currentIndex] = array[randomIndex]
120+
// @ts-expect-error
119121
array[randomIndex] = temporaryValue
120122
}
121123
return array

0 commit comments

Comments
 (0)