Skip to content

Commit 4b3e967

Browse files
committed
only load async in flow editor
1 parent 80dd6e4 commit 4b3e967

File tree

3 files changed

+27
-13
lines changed

3 files changed

+27
-13
lines changed

frontend/src/lib/components/InputTransformForm.svelte

+2
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,7 @@
515515
on:change={() => {
516516
dispatch('change', { argName, arg })
517517
}}
518+
loadAsync
518519
/>
519520
{/if}
520521
</div>
@@ -583,6 +584,7 @@
583584
focused = false
584585
}}
585586
autoHeight
587+
loadAsync
586588
/>
587589
</div>
588590
{#if !hideHelpButton}

frontend/src/lib/components/SimpleEditor.svelte

+15-9
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@
100100
autofocus = false,
101101
allowVim = false,
102102
tailwindClasses = [],
103-
class: className = ''
103+
class: className = '',
104+
loadAsync = false
104105
} = $props<{
105106
lang: string
106107
code?: string
@@ -122,6 +123,7 @@
122123
allowVim?: boolean
123124
tailwindClasses?: string[]
124125
class?: string
126+
loadAsync?: boolean
125127
}>()
126128
127129
const dispatch = createEventDispatcher()
@@ -510,16 +512,20 @@
510512
}
511513
}
512514
513-
onMount(() => {
514-
setTimeout(async () => {
515-
if (BROWSER) {
516-
mounted = true
515+
onMount(async () => {
516+
if (BROWSER) {
517+
if (loadAsync) {
518+
setTimeout(async () => {
519+
await loadMonaco()
520+
mounted = true
521+
if (autofocus) setTimeout(() => focus(), 0)
522+
}, 0)
523+
} else {
517524
await loadMonaco()
518-
if (autofocus) {
519-
setTimeout(() => focus(), 0)
520-
}
525+
mounted = true
526+
if (autofocus) setTimeout(() => focus(), 0)
521527
}
522-
}, 0)
528+
}
523529
})
524530
525531
$effect(() => {

frontend/src/lib/components/TemplateEditor.svelte

+10-4
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,7 @@
375375
export let autoHeight = true
376376
export let fixedOverflowWidgets = true
377377
export let fontSize = 16
378+
export let loadAsync = false
378379
379380
if (typeof code != 'string') {
380381
code = ''
@@ -593,13 +594,18 @@
593594
}
594595
595596
let mounted = false
596-
onMount(() => {
597-
setTimeout(async () => {
598-
if (BROWSER) {
597+
onMount(async () => {
598+
if (BROWSER) {
599+
if (loadAsync) {
600+
setTimeout(async () => {
601+
await loadMonaco()
602+
mounted = true
603+
}, 0)
604+
} else {
599605
await loadMonaco()
600606
mounted = true
601607
}
602-
}, 0)
608+
}
603609
})
604610
605611
$: mounted && extraLib && initialized && loadExtraLib()

0 commit comments

Comments
 (0)