Skip to content

Commit fae18eb

Browse files
committed
Fix modal position restore
1 parent 6f9554c commit fae18eb

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,10 @@ function loadPosition(): Position | undefined {
2525
let cachedPosition: Position | undefined
2626

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

3030
useEffect(function loadDefaultPosition() {
31-
const defaultPosition = loadPosition()
32-
if (!defaultPosition) return
31+
const defaultPosition = loadPosition() || { x: 0, y: 0 }
3332

3433
setPosition(defaultPosition)
3534
cachedPosition = defaultPosition

0 commit comments

Comments
 (0)