Skip to content

Commit 30ba77d

Browse files
committed
feat: add loading for fetch module transforms
1 parent 0662f01 commit 30ba77d

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

packages/devtools/src/app/components/flowmap/ModuleFlow.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import PluginName from '../display/PluginName.vue'
77
const props = defineProps<{
88
info: ModuleInfo
99
session: SessionContext
10+
transformsLoading: boolean
1011
}>()
1112
const { info } = toRefs(props)
1213
@@ -246,7 +247,8 @@ const codeDisplay = computed(() => {
246247
>
247248
<template #node>
248249
<div i-ph-magic-wand-duotone /> Transform
249-
<span op50 text-xs>({{ info.transforms.length }})</span>
250+
<span v-if="transformsLoading" i-ph-spinner animate-spin />
251+
<span v-else op50 text-xs>({{ info.transforms.length }})</span>
250252
</template>
251253
<template #container>
252254
<div>

packages/devtools/src/app/components/flowmap/ModuleFlowLoader.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,17 @@ const props = defineProps<{
1111
1212
const rpc = useRpc()
1313
const transforms = ref<RolldownModuleTransformInfo[]>([])
14+
const transformsLoading = ref(false)
1415
watchEffect(async () => {
1516
const arg = {
1617
session: props.session.id,
1718
module: props.module,
1819
}
1920
// fetch transforms in the next tick to avoid race conditions with module info
2021
nextTick(async () => {
22+
transformsLoading.value = true
2123
transforms.value = await rpc.value!['vite:rolldown:get-module-transforms']?.(arg)
24+
transformsLoading.value = false
2225
})
2326
})
2427
@@ -41,6 +44,7 @@ const info = computedAsync(async () => {
4144
p4
4245
:info
4346
:session
47+
:transforms-loading
4448
/>
4549
<ChartModuleFlamegraph
4650
:info

0 commit comments

Comments
 (0)