mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-21 17:26:29 -05:00
fix: don't double load iframe content
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
d5455f7c33
commit
62abd9cbe0
2 changed files with 4 additions and 10 deletions
|
@ -7,7 +7,7 @@ import { ORIGIN, useBaseUrl } from '../../../../hooks/common/use-base-url'
|
|||
import { Logger } from '../../../../utils/logger'
|
||||
import { useEditorToRendererCommunicator } from '../../../editor-page/render-context/editor-to-renderer-communicator-context-provider'
|
||||
import type { RefObject } from 'react'
|
||||
import { useCallback, useEffect, useMemo, useRef } from 'react'
|
||||
import { useCallback, useMemo, useRef } from 'react'
|
||||
|
||||
const log = new Logger('IframeLoader')
|
||||
|
||||
|
@ -31,7 +31,7 @@ export const useForceRenderPageUrlOnIframeLoadCallback = (
|
|||
}, [iframeCommunicator, rendererBaseUrl])
|
||||
const redirectionInProgress = useRef<boolean>(false)
|
||||
|
||||
const loadCallback = useCallback(() => {
|
||||
return useCallback(() => {
|
||||
const frame = iFrameReference.current
|
||||
|
||||
if (!frame) {
|
||||
|
@ -50,10 +50,4 @@ export const useForceRenderPageUrlOnIframeLoadCallback = (
|
|||
frame.src = forcedUrl
|
||||
}
|
||||
}, [iFrameReference, onNavigateAway, forcedUrl])
|
||||
|
||||
useEffect(() => {
|
||||
loadCallback()
|
||||
}, [loadCallback])
|
||||
|
||||
return loadCallback
|
||||
}
|
||||
|
|
|
@ -78,9 +78,9 @@ export const RendererIframe: React.FC<RendererIframeProps> = ({
|
|||
|
||||
useEffect(() => {
|
||||
if (rendererReady) {
|
||||
log.info('Renderer Ready!')
|
||||
log.debug('Renderer Ready!')
|
||||
} else {
|
||||
log.info('Renderer not ready')
|
||||
log.debug('Renderer not ready')
|
||||
}
|
||||
}, [log, rendererReady])
|
||||
|
||||
|
|
Loading…
Reference in a new issue