mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-10-13 00:03:00 +00:00
close raw app preview pop-out when the editor tab reloads or closes (#11607)
This commit is contained in:
@@ -1839,13 +1839,15 @@ addEventListener('message', function (e) {
|
||||
syncExternalPreviewNotice()
|
||||
syncExternalPreview()
|
||||
}
|
||||
|
||||
onDestroy(() => {
|
||||
// Don't leave a detached preview behind when the editor unmounts: it
|
||||
// would stop receiving builds and, once refreshed, has no opener to
|
||||
|
||||
// Don't leave a detached preview behind when the editor goes away, by
|
||||
// unmounting or by its tab reloading or closing (`pagehide`, which skips
|
||||
// `onDestroy`): it would stop receiving builds, and its document is a blob
|
||||
// URL owned by this page, so refreshing it gives "not found".
|
||||
function closeExternalPreview() {
|
||||
if (externalPreviewWindow && !externalPreviewWindow.closed) externalPreviewWindow.close()
|
||||
externalPreviewWindow = null
|
||||
externalPreviewWindow = null
|
||||
}
|
||||
onDestroy(closeExternalPreview)
|
||||
|
||||
function openExternalPreview() {
|
||||
@@ -2512,7 +2514,7 @@ addEventListener('message', function (e) {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<svelte:window onmessage={listener} onkeydown={handleKeydown} onpagehide={closeExternalPreview} />
|
||||
<DarkModeObserver
|
||||
bind:darkMode
|
||||
|
||||
Reference in New Issue
Block a user