fix: TypeError: Cannot read properties of undefined (reading 'viewport' #1761 (#1784)

### What problem does this PR solve?

fix: TypeError: Cannot read properties of undefined (reading 'viewport'
#1761

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
balibabu 2024-08-02 11:22:10 +08:00 committed by GitHub
parent 3f21603558
commit eea6565472
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -41,7 +41,7 @@ const Preview = ({ highlights: state, setWidthAndHeight }: IProps) => {
useEffect(() => {
if (state.length > 0) {
ref.current(state[0]);
ref?.current(state[0]);
}
}, [state]);