only load async in flow editor

This commit is contained in:
Diego Imbert
2025-04-16 16:33:55 +02:00
parent 80dd6e48f6
commit 4b3e9673cd
3 changed files with 27 additions and 13 deletions
@@ -515,6 +515,7 @@
on:change={() => {
dispatch('change', { argName, arg })
}}
loadAsync
/>
{/if}
</div>
@@ -583,6 +584,7 @@
focused = false
}}
autoHeight
loadAsync
/>
</div>
{#if !hideHelpButton}
@@ -100,7 +100,8 @@
autofocus = false,
allowVim = false,
tailwindClasses = [],
class: className = ''
class: className = '',
loadAsync = false
} = $props<{
lang: string
code?: string
@@ -122,6 +123,7 @@
allowVim?: boolean
tailwindClasses?: string[]
class?: string
loadAsync?: boolean
}>()
const dispatch = createEventDispatcher()
@@ -510,16 +512,20 @@
}
}
onMount(() => {
setTimeout(async () => {
if (BROWSER) {
mounted = true
onMount(async () => {
if (BROWSER) {
if (loadAsync) {
setTimeout(async () => {
await loadMonaco()
mounted = true
if (autofocus) setTimeout(() => focus(), 0)
}, 0)
} else {
await loadMonaco()
if (autofocus) {
setTimeout(() => focus(), 0)
}
mounted = true
if (autofocus) setTimeout(() => focus(), 0)
}
}, 0)
}
})
$effect(() => {
@@ -375,6 +375,7 @@
export let autoHeight = true
export let fixedOverflowWidgets = true
export let fontSize = 16
export let loadAsync = false
if (typeof code != 'string') {
code = ''
@@ -593,13 +594,18 @@
}
let mounted = false
onMount(() => {
setTimeout(async () => {
if (BROWSER) {
onMount(async () => {
if (BROWSER) {
if (loadAsync) {
setTimeout(async () => {
await loadMonaco()
mounted = true
}, 0)
} else {
await loadMonaco()
mounted = true
}
}, 0)
}
})
$: mounted && extraLib && initialized && loadExtraLib()