Skip to content

Commit 6f9554c

Browse files
committed
Cleanup
1 parent 9d33794 commit 6f9554c

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/theme/CodeBlock/VideoPlayer/VideoModal/usePosition.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import {
22
useCallback,
33
useEffect,
4-
useRef,
54
useState,
65
} from 'react'
76

@@ -26,10 +25,12 @@ function loadPosition(): Position | undefined {
2625
let cachedPosition: Position | undefined
2726

2827
function usePosition() {
29-
const [position, setPosition] = useState<Position | undefined>(cachedPosition || { x: 0, y: 0 })
28+
const [position, setPosition] = useState<Position>(cachedPosition || { x: 0, y: 0 })
3029

3130
useEffect(function loadDefaultPosition() {
3231
const defaultPosition = loadPosition()
32+
if (!defaultPosition) return
33+
3334
setPosition(defaultPosition)
3435
cachedPosition = defaultPosition
3536
}, [])

0 commit comments

Comments
 (0)