Skip to content

Commit fbd1188

Browse files
committed
Simplify app ready animation frame handling
1 parent 4ee7d67 commit fbd1188

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

frontend/src/app/components/app-ready.tsx

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,17 @@ export function AppReadyEffect() {
99
return
1010
}
1111

12-
let frame1: number | null = null
13-
let frame2: number | null = null
12+
let frame: number | null = null
1413

1514
const markReady = () => {
1615
appElement.setAttribute('data-ready', 'true')
1716
}
1817

19-
frame1 = requestAnimationFrame(() => {
20-
frame2 = requestAnimationFrame(markReady)
21-
})
18+
frame = requestAnimationFrame(markReady)
2219

2320
return () => {
24-
if (frame1 !== null) {
25-
cancelAnimationFrame(frame1)
26-
}
27-
if (frame2 !== null) {
28-
cancelAnimationFrame(frame2)
21+
if (frame !== null) {
22+
cancelAnimationFrame(frame)
2923
}
3024
}
3125
}, [])

0 commit comments

Comments
 (0)