fix(frontend): forking UI issues (#7215)

* fix(frontend): forking UI issues

* fix dark mode
This commit is contained in:
hugocasa
2025-11-24 21:41:05 +00:00
committed by GitHub
parent a2d3297343
commit dccee1dba0
9 changed files with 177 additions and 62 deletions
@@ -123,6 +123,8 @@
enablePreprocessorSnippet = false
}: Props = $props()
let initialArgs = structuredClone($state.snapshot(args))
$effect.pre(() => {
if (schema == undefined) {
schema = emptySchema()
@@ -269,7 +271,18 @@
})
}
export async function inferSchema(code: string, nlang?: SupportedLanguage, resetArgs = false) {
export async function inferSchema(
code: string,
{
nlang,
resetArgs = false,
applyInitialArgs = false
}: {
nlang?: SupportedLanguage
resetArgs?: boolean
applyInitialArgs?: boolean
} = {}
) {
let nschema = schema ?? emptySchema()
try {
@@ -297,6 +310,10 @@
if (resetArgs) {
args = {}
}
if (applyInitialArgs) {
// we reapply initial args as the schema form might have cleared them between mount and the schema inference
args = initialArgs
}
schema = nschema
} catch (e) {
validCode = false
@@ -338,7 +355,7 @@
}
onMount(() => {
inferSchema(code)
inferSchema(code, { applyInitialArgs: true })
loadPastTests()
aiChatManager.saveAndClear()
aiChatManager.changeMode(AIMode.SCRIPT)