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 {
45
45
}
46
46
47
47
const ref = useRef < HTMLIFrameElement > ( null ) ;
48
- const [ height , setHeight ] = useState ( "0px" ) ;
48
+ const [ iframeHeight , setIframeHeight ] = useState ( "0px" ) ;
49
49
50
50
// Poll the size of the iframe content and set the height
51
51
// This will only work where the iframe is served from the same origin
52
- const doHeight = useCallback ( ( ) => {
52
+ const calculateHeight = useCallback ( ( ) => {
53
53
const height =
54
54
ref . current ?. contentWindow ?. document . body . parentElement ?. scrollHeight ;
55
55
if ( height ) {
56
- setHeight ( `${ height } px` ) ;
56
+ setIframeHeight ( `${ height } px` ) ;
57
57
} else {
58
- setHeight ( "500px" ) ;
58
+ setIframeHeight ( "500px" ) ;
59
59
}
60
60
} , [ ] ) ;
61
61
useEffect ( ( ) => {
62
- doHeight ( ) ;
62
+ calculateHeight ( ) ;
63
63
64
64
const interval = setInterval ( ( ) => {
65
- doHeight ( ) ;
65
+ calculateHeight ( ) ;
66
66
} , 1000 ) ;
67
67
68
68
return ( ) => clearInterval ( interval ) ;
69
- } , [ doHeight ] ) ;
69
+ } , [ calculateHeight ] ) ;
70
70
71
71
return (
72
72
< iframe
73
- title = "asd"
73
+ title = "iframe" // no proper title as this is experimental feature
74
74
ref = { ref }
75
- onLoad = { doHeight }
75
+ onLoad = { calculateHeight }
76
76
src = { planManagementIframeUri }
77
77
scrolling = "no"
78
- height = { height }
78
+ height = { iframeHeight }
79
79
/>
80
80
) ;
81
81
}
You can’t perform that action at this time.
0 commit comments