File tree Expand file tree Collapse file tree 1 file changed +10
-10
lines changed
Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -45,37 +45,37 @@ function Plan(): React.ReactElement {
4545 }
4646
4747 const ref = useRef < HTMLIFrameElement > ( null ) ;
48- const [ height , setHeight ] = useState ( "0px" ) ;
48+ const [ iframeHeight , setIframeHeight ] = useState ( "0px" ) ;
4949
5050 // Poll the size of the iframe content and set the height
5151 // This will only work where the iframe is served from the same origin
52- const doHeight = useCallback ( ( ) => {
52+ const calculateHeight = useCallback ( ( ) => {
5353 const height =
5454 ref . current ?. contentWindow ?. document . body . parentElement ?. scrollHeight ;
5555 if ( height ) {
56- setHeight ( `${ height } px` ) ;
56+ setIframeHeight ( `${ height } px` ) ;
5757 } else {
58- setHeight ( "500px" ) ;
58+ setIframeHeight ( "500px" ) ;
5959 }
6060 } , [ ] ) ;
6161 useEffect ( ( ) => {
62- doHeight ( ) ;
62+ calculateHeight ( ) ;
6363
6464 const interval = setInterval ( ( ) => {
65- doHeight ( ) ;
65+ calculateHeight ( ) ;
6666 } , 1000 ) ;
6767
6868 return ( ) => clearInterval ( interval ) ;
69- } , [ doHeight ] ) ;
69+ } , [ calculateHeight ] ) ;
7070
7171 return (
7272 < iframe
73- title = "asd"
73+ title = "iframe" // no proper title as this is experimental feature
7474 ref = { ref }
75- onLoad = { doHeight }
75+ onLoad = { calculateHeight }
7676 src = { planManagementIframeUri }
7777 scrolling = "no"
78- height = { height }
78+ height = { iframeHeight }
7979 />
8080 ) ;
8181}
You can’t perform that action at this time.
0 commit comments