fix: set key to iframes to fix browser history stack (back button navigation)

pull/11755/head
5war00p 2023-10-09 00:52:03 +05:30
parent 88d438f227
commit 63a4c79c92
No known key found for this signature in database
GPG Key ID: C8244F1AC5622CCD
2 changed files with 9 additions and 10 deletions

View File

@ -126,7 +126,7 @@ export const AppPage = ({
<div <div
key={`iframe-${index}`} key={`iframe-${index}`}
className="mr-4 max-h-full min-h-[315px] min-w-[90%] max-w-full snap-center last:mb-0 lg:mb-4 lg:mr-0 [&_iframe]:h-full [&_iframe]:min-h-[315px] [&_iframe]:w-full"> className="mr-4 max-h-full min-h-[315px] min-w-[90%] max-w-full snap-center last:mb-0 lg:mb-4 lg:mr-0 [&_iframe]:h-full [&_iframe]:min-h-[315px] [&_iframe]:w-full">
<iframe allowFullScreen {...descriptionItem.iframe} /> <iframe key={`iframe_${index}`} allowFullScreen {...descriptionItem.iframe} />
</div> </div>
) : ( ) : (
<img <img

View File

@ -47,19 +47,17 @@ export const tabs = [
className="text-default bg-default selection:bg-subtle h-[calc(100%-50px)] font-mono" className="text-default bg-default selection:bg-subtle h-[calc(100%-50px)] font-mono"
style={{ resize: "none", overflow: "auto" }} style={{ resize: "none", overflow: "auto" }}
readOnly readOnly
value={ value={`<!-- Cal ${embedType} embed code begins -->\n${
`<!-- Cal ${embedType} embed code begins -->\n` + embedType === "inline"
(embedType === "inline"
? `<div style="width:${getDimension(previewState.inline.width)};height:${getDimension( ? `<div style="width:${getDimension(previewState.inline.width)};height:${getDimension(
previewState.inline.height previewState.inline.height
)};overflow:scroll" id="my-cal-inline"></div>\n` )};overflow:scroll" id="my-cal-inline"></div>\n`
: "") + : ""
`<script type="text/javascript"> }<script type="text/javascript">
${embedSnippetString} ${embedSnippetString}
${getEmbedTypeSpecificString({ embedFramework: "HTML", embedType, calLink, previewState, embedCalOrigin })} ${getEmbedTypeSpecificString({ embedFramework: "HTML", embedType, calLink, previewState, embedCalOrigin })}
</script> </script>
<!-- Cal ${embedType} embed code ends -->` <!-- Cal ${embedType} embed code ends -->`}
}
/> />
<p className="text-subtle hidden text-sm">{t("need_help_embedding")}</p> <p className="text-subtle hidden text-sm">{t("need_help_embedding")}</p>
</> </>
@ -126,6 +124,7 @@ export const tabs = [
} }
return ( return (
<iframe <iframe
key={EMBED_PREVIEW_HTML_URL}
ref={ref as typeof ref & MutableRefObject<HTMLIFrameElement>} ref={ref as typeof ref & MutableRefObject<HTMLIFrameElement>}
data-testid="embed-preview" data-testid="embed-preview"
className="h-[100vh] border" className="h-[100vh] border"