nit fixes app
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { Button } from '$lib/components/common'
|
||||
import { getContext, onDestroy, untrack } from 'svelte'
|
||||
import { getContext, onDestroy, onMount, untrack } from 'svelte'
|
||||
import type { AppInput } from '../../inputType'
|
||||
import type {
|
||||
AppViewerContext,
|
||||
@@ -190,6 +190,15 @@
|
||||
.filter((x) => x != '')
|
||||
.join('\n')
|
||||
)
|
||||
|
||||
// $inspect(result)
|
||||
const rid = Math.random()
|
||||
onMount(() => {
|
||||
console.log('onMount', rid, id)
|
||||
})
|
||||
onDestroy(() => {
|
||||
console.log('onDestroy', rid, id)
|
||||
})
|
||||
</script>
|
||||
|
||||
{#each Object.entries(components['buttoncomponent'].initialData.configuration) as [key, initialConfig] (key)}
|
||||
|
||||
@@ -126,7 +126,6 @@
|
||||
const debounceEval = async (s?: string) => {
|
||||
let args = s == 'exprChanged' ? { file: { name: 'example.png' } } : undefined
|
||||
let nvalue = await evalExpr(input as EvalAppInput, args)
|
||||
|
||||
if (field) {
|
||||
editorContext?.evalPreview.update((x) => {
|
||||
x[`${id}.${field}`] = nvalue
|
||||
@@ -137,7 +136,6 @@
|
||||
if (!onDemandOnly) {
|
||||
let nhash = typeof nvalue != 'object' ? nvalue : sum(nvalue)
|
||||
if (lastExprHash != nhash) {
|
||||
// console.log('eval changed', field, nvalue)
|
||||
value = nvalue
|
||||
lastExprHash = nhash
|
||||
}
|
||||
@@ -168,6 +166,8 @@
|
||||
await debounceTemplate()
|
||||
} else if (input?.type == 'eval') {
|
||||
value = await evalExpr(input as EvalAppInput)
|
||||
let nhash = typeof value != 'object' ? value : sum(value)
|
||||
lastExprHash = nhash
|
||||
} else if (input?.type == 'evalv2') {
|
||||
// console.log('evalv2', onDemandOnly, field)
|
||||
if (onDemandOnly && exportValueFunction) {
|
||||
@@ -347,7 +347,6 @@
|
||||
) &&
|
||||
untrack(() => debounceTemplate())
|
||||
})
|
||||
let stateId = $derived($worldStore?.stateId)
|
||||
$effect(() => {
|
||||
input?.type == 'static' && input.value
|
||||
input && $worldStore && untrack(() => debounce(handleConnection))
|
||||
@@ -356,17 +355,25 @@
|
||||
input &&
|
||||
input.type == 'template' &&
|
||||
isCodeInjection(input.eval) &&
|
||||
$stateId &&
|
||||
$stateStore &&
|
||||
untrack(() => debounce(debounceTemplate))
|
||||
})
|
||||
$effect.pre(() => {
|
||||
input &&
|
||||
input.type == 'eval' &&
|
||||
$stateId &&
|
||||
$stateStore &&
|
||||
untrack(() => debounce2(debounceEval))
|
||||
input && input.type == 'eval' && $stateStore && untrack(() => debounce2(debounceEval))
|
||||
})
|
||||
|
||||
if (input?.type == 'eval') {
|
||||
$worldStore?.stateId.subscribe((x) => {
|
||||
debounce2(debounceEval)
|
||||
})
|
||||
}
|
||||
|
||||
if (input?.type == 'template') {
|
||||
$worldStore?.stateId.subscribe((x) => {
|
||||
debounce2(debounceTemplate)
|
||||
})
|
||||
}
|
||||
|
||||
$effect.pre(() => {
|
||||
input?.type == 'evalv2' && input.expr && untrack(() => debounceEval('exprChanged'))
|
||||
})
|
||||
|
||||
@@ -145,8 +145,14 @@ export function createAppFromScript(path: string, schema: Record<string, any> |
|
||||
value: false
|
||||
},
|
||||
disabled: {
|
||||
type: 'eval',
|
||||
expr: '!c.valid'
|
||||
type: 'evalv2',
|
||||
expr: '!c.valid',
|
||||
connections: [
|
||||
{
|
||||
componentId: 'c',
|
||||
id: 'valid'
|
||||
}
|
||||
]
|
||||
},
|
||||
beforeIcon: {
|
||||
type: 'static',
|
||||
@@ -705,8 +711,14 @@ export function createAppFromFlow(path: string, schema: Record<string, any> | un
|
||||
value: false
|
||||
},
|
||||
disabled: {
|
||||
type: 'eval',
|
||||
expr: '!c.valid'
|
||||
type: 'evalv2',
|
||||
expr: '!c.valid',
|
||||
connections: [
|
||||
{
|
||||
componentId: 'c',
|
||||
id: 'valid'
|
||||
}
|
||||
]
|
||||
},
|
||||
beforeIcon: {
|
||||
type: 'static',
|
||||
|
||||
Reference in New Issue
Block a user