Fix preview scripts with wrong tag (#7999)

This commit is contained in:
Diego Imbert
2026-02-18 15:28:35 +01:00
committed by GitHub
parent 1ca49aefd5
commit 7e3b9f05bb
4 changed files with 11 additions and 2 deletions

View File

@@ -142,6 +142,8 @@
rawAppRunnableKey?: string | undefined
// Used to provide typed queries in TypeScript when detecting assets
preparedAssetsSqlQueries?: InferAssetsSqlQueryDetails[] | undefined
// To execute preview scripts with the right worker group
customTag?: string
}
let {
@@ -171,7 +173,8 @@
moduleId = undefined,
enablePreprocessorSnippet = false,
rawAppRunnableKey = undefined,
preparedAssetsSqlQueries
preparedAssetsSqlQueries,
customTag
}: Props = $props()
$effect.pre(() => {
@@ -595,7 +598,8 @@
lang === 'graphql' ? 'graphql' : (scriptLang ?? ''),
resourcePath,
$workspaceStore,
(e) => console.error(`error getting ${lang} (${scriptLang}) db schema`, e)
(e) => console.error(`error getting ${lang} (${scriptLang}) db schema`, e),
{ customTag }
)
}
dbSchema = $dbSchemas[resourcePath]

View File

@@ -1415,6 +1415,7 @@
{args}
{enablePreprocessorSnippet}
preparedAssetsSqlQueries={preparedSqlQueries.current}
customTag={tag}
/>
<DiffEditor
className="h-full"

View File

@@ -402,6 +402,7 @@ export async function getDbSchemas(
errorCallback: (message: string) => void,
options: {
useLegacyScripts?: boolean // To avoid breaking app policies
customTag?: string
} = {}
): Promise<DBSchema | undefined> {
let scripts = options.useLegacyScripts ? legacyScripts : scriptsV2
@@ -416,6 +417,7 @@ export async function getDbSchemas(
requestBody: {
language: sqlScript.lang as Preview['language'],
content: sqlScript.code,
tag: options.customTag,
args: {
[sqlScript.argName]: resourcePath.startsWith('datatable://')
? resourcePath

View File

@@ -895,6 +895,7 @@
key={`flow-inline-${$workspaceStore}-${$pathStore}-${flowModule.id}`}
moduleId={flowModule.id}
preparedAssetsSqlQueries={preparedSqlQueries.current}
customTag={flowModule.value.tag}
/>
</div>
</Pane>
@@ -957,6 +958,7 @@
key={`flow-inline-${$workspaceStore}-${$pathStore}-${flowModule.id}`}
moduleId={flowModule.id}
preparedAssetsSqlQueries={preparedSqlQueries.current}
customTag={flowModule.value.tag}
/>
</div>
{/if}