mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-22 01:36: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 { Logger } from '../../../../utils/logger'
|
||||||
import { useEditorToRendererCommunicator } from '../../../editor-page/render-context/editor-to-renderer-communicator-context-provider'
|
import { useEditorToRendererCommunicator } from '../../../editor-page/render-context/editor-to-renderer-communicator-context-provider'
|
||||||
import type { RefObject } from 'react'
|
import type { RefObject } from 'react'
|
||||||
import { useCallback, useEffect, useMemo, useRef } from 'react'
|
import { useCallback, useMemo, useRef } from 'react'
|
||||||
|
|
||||||
const log = new Logger('IframeLoader')
|
const log = new Logger('IframeLoader')
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ export const useForceRenderPageUrlOnIframeLoadCallback = (
|
||||||
}, [iframeCommunicator, rendererBaseUrl])
|
}, [iframeCommunicator, rendererBaseUrl])
|
||||||
const redirectionInProgress = useRef<boolean>(false)
|
const redirectionInProgress = useRef<boolean>(false)
|
||||||
|
|
||||||
const loadCallback = useCallback(() => {
|
return useCallback(() => {
|
||||||
const frame = iFrameReference.current
|
const frame = iFrameReference.current
|
||||||
|
|
||||||
if (!frame) {
|
if (!frame) {
|
||||||
|
@ -50,10 +50,4 @@ export const useForceRenderPageUrlOnIframeLoadCallback = (
|
||||||
frame.src = forcedUrl
|
frame.src = forcedUrl
|
||||||
}
|
}
|
||||||
}, [iFrameReference, onNavigateAway, forcedUrl])
|
}, [iFrameReference, onNavigateAway, forcedUrl])
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
loadCallback()
|
|
||||||
}, [loadCallback])
|
|
||||||
|
|
||||||
return loadCallback
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,9 +78,9 @@ export const RendererIframe: React.FC<RendererIframeProps> = ({
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (rendererReady) {
|
if (rendererReady) {
|
||||||
log.info('Renderer Ready!')
|
log.debug('Renderer Ready!')
|
||||||
} else {
|
} else {
|
||||||
log.info('Renderer not ready')
|
log.debug('Renderer not ready')
|
||||||
}
|
}
|
||||||
}, [log, rendererReady])
|
}, [log, rendererReady])
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue