finding of screen onload

This commit is contained in:
Peter Clement 2025-01-27 09:01:39 +00:00
parent 43b7dc5d7b
commit 09f4db6b57
1 changed files with 24 additions and 4 deletions

View File

@ -47,6 +47,10 @@
previousScreenId = $selectedScreen._id previousScreenId = $selectedScreen._id
} }
if (keyOptions.length > 0 && !keyOptions.includes(selectedKey)) {
selectedKey = keyOptions[0]
}
if (selectedKey) { if (selectedKey) {
searchComponents(selectedKey) searchComponents(selectedKey)
editorValue = previewContext.state?.[selectedKey] ?? "" editorValue = previewContext.state?.[selectedKey] ?? ""
@ -180,14 +184,30 @@
return return
} }
const componentStateUpdates = findComponentsUpdatingState(
$selectedScreen.props,
stateKey
)
componentsUsingState = findComponentsUsingState( componentsUsingState = findComponentsUsingState(
$selectedScreen.props, $selectedScreen.props,
stateKey stateKey
) )
componentsUpdatingState = findComponentsUpdatingState(
$selectedScreen.props, const screenStateUpdates =
stateKey $selectedScreen?.onLoad
?.filter(
(handler: any) =>
handler["##eventHandlerType"] === "Update State" &&
handler.parameters?.key === stateKey
) )
.map(() => ({
id: $selectedScreen._id,
name: "Screen onLoad",
settings: ["onLoad"],
})) || []
componentsUpdatingState = [...componentStateUpdates, ...screenStateUpdates]
} }
const handleStateKeySelect = (key: CustomEvent) => { const handleStateKeySelect = (key: CustomEvent) => {