Fixed randomly not loading comments area

refs https://github.com/TryGhost/Team/issues/1696

- Wait for the iframe to load before sending messages to it
- High chance this fixes the issue, but still need to monitor if this was the real cause.
This commit is contained in:
Simon Backx 2022-07-20 16:30:28 +02:00
parent 723b35bfa6
commit 28921a8dbf

View File

@ -7,22 +7,15 @@ import AppContext from './AppContext';
import {hasMode} from './utils/check-mode';
import setupGhostApi from './utils/api';
import CommentsBox from './components/CommentsBox';
import {useEffect} from 'react';
import Loading from './components/Loading';
function AuthFrame({adminUrl, onLoad, initStatus}) {
useEffect(function () {
if (initStatus !== 'success') {
onLoad();
}
}, [onLoad, initStatus]);
function AuthFrame({adminUrl, onLoad}) {
const iframeStyle = {
display: 'none'
};
return (
<iframe data-frame="admin-auth" src={adminUrl + 'auth-frame/'} style={iframeStyle} title="auth-frame"></iframe>
<iframe data-frame="admin-auth" src={adminUrl + 'auth-frame/'} style={iframeStyle} title="auth-frame" onLoad={onLoad}></iframe>
);
}