diff --git a/frontend/src/lib/components/apps/components/buttons/AppButton.svelte b/frontend/src/lib/components/apps/components/buttons/AppButton.svelte
index 8ec9475f30..3cec5c1868 100644
--- a/frontend/src/lib/components/apps/components/buttons/AppButton.svelte
+++ b/frontend/src/lib/components/apps/components/buttons/AppButton.svelte
@@ -1,6 +1,6 @@
{#each Object.entries(components['buttoncomponent'].initialData.configuration) as [key, initialConfig] (key)}
diff --git a/frontend/src/lib/components/apps/components/helpers/InputValue.svelte b/frontend/src/lib/components/apps/components/helpers/InputValue.svelte
index 3307087563..eed765c6fb 100644
--- a/frontend/src/lib/components/apps/components/helpers/InputValue.svelte
+++ b/frontend/src/lib/components/apps/components/helpers/InputValue.svelte
@@ -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'))
})
diff --git a/frontend/src/lib/components/details/createAppFromScript.ts b/frontend/src/lib/components/details/createAppFromScript.ts
index 7dfe1c517a..b359e7367c 100644
--- a/frontend/src/lib/components/details/createAppFromScript.ts
+++ b/frontend/src/lib/components/details/createAppFromScript.ts
@@ -145,8 +145,14 @@ export function createAppFromScript(path: string, schema: Record |
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 | un
value: false
},
disabled: {
- type: 'eval',
- expr: '!c.valid'
+ type: 'evalv2',
+ expr: '!c.valid',
+ connections: [
+ {
+ componentId: 'c',
+ id: 'valid'
+ }
+ ]
},
beforeIcon: {
type: 'static',