We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When we redirect in a component using useSize in the first render, we get this error: Cannot read property 'contentWindow' of null
Cannot read property 'contentWindow' of null
https://codesandbox.io/s/react-use-usesize-error-xo3q4
This seems to be causing the issue:
react-use/src/useSize.tsx
Lines 48 to 51 in cf68e36
We can check if iframe is defined before accessing it's property
... useEffect(() => { const iframe: HTMLIFrameElement = ref.current!; if(!iframe) { // this will happen if component is already unmounted return; } if (iframe.contentWindow) { ...
The text was updated successfully, but these errors were encountered:
chore(release): 9.8.2 [skip ci]
b55427e
## [9.8.2](v9.8.1...v9.8.2) (2019-07-08) ### Bug Fixes * **useSize:** prevents accessing iframe's property when it's not defined ([c9b5cdc](c9b5cdc)), closes [#442](#442) * **useSize:** prevents accessing iframe's property when it's not… ([#443](#443)) ([8f04e8f](8f04e8f)) * iframe can be null ([a9e3bab](a9e3bab))
No branches or pull requests
Problem
When we redirect in a component using useSize in the first render, we get this error:
Cannot read property 'contentWindow' of null
Reproduction link
https://codesandbox.io/s/react-use-usesize-error-xo3q4
Cause
This seems to be causing the issue:
react-use/src/useSize.tsx
Lines 48 to 51 in cf68e36
Possible solution
We can check if iframe is defined before accessing it's property
The text was updated successfully, but these errors were encountered: