Update comment loading match

This commit is contained in:
DefectingCat
2022-01-04 10:16:20 +08:00
parent 6859bf9e02
commit 3f5796a122

View File

@ -8,6 +8,8 @@ const PostCommentLoading = dynamic(
() => import('components/loading/PostCommentLoading')
);
const ready = /\[iFrameSizer\]\iFrameResizer.*?\:init/;
const PostComment: FC = () => {
const { giscusColor } = useGetColors();
@ -18,10 +20,7 @@ const PostComment: FC = () => {
* When get the message, its mean Giscus component loading completed.
*/
const handleMessage = useCallback((event: MessageEvent) => {
if (
event.origin === 'https://giscus.app' &&
event.data === '[iFrameResizerChild]Ready'
) {
if (event.origin === 'https://giscus.app' && ready.test(event.data)) {
setCommentLoaded(true);
}
// if (!(typeof event.data === 'object' && event.data.giscus)) return;