fix: parse assets on inline script module creation to avoid false toast (#8835)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Diego Imbert
2026-04-15 11:01:07 +00:00
committed by GitHub
co-authored by Claude Opus 4.6
parent a98f5b9dfd
commit 12d0a3de08
@@ -9,6 +9,7 @@ import {
type Script
} from '$lib/gen'
import { initialCode } from '$lib/script_helpers'
import { inferAssets } from '$lib/infer'
import { userStore, workspaceStore } from '$lib/stores'
import { getScriptByPath } from '$lib/scripts'
import { get } from 'svelte/store'
@@ -84,6 +85,11 @@ export async function createInlineScriptModule(
): Promise<[FlowModule, FlowModuleState]> {
const code = initialCode(language, kind, subkind)
// Needed when the predefined code has assets in it
const inferResult = await inferAssets(language, code)
const assets =
inferResult.status === 'ok' && inferResult.assets.length > 0 ? inferResult.assets : undefined
const flowModule: FlowModule = {
id,
summary,
@@ -92,7 +98,8 @@ export async function createInlineScriptModule(
content: code,
language,
input_transforms: {},
...(kind === 'trigger' ? { is_trigger: true } : {})
...(kind === 'trigger' ? { is_trigger: true } : {}),
...(assets ? { assets } : {})
}
}