fix: fix plug connection for apps with array items

This commit is contained in:
Ruben Fiszel
2024-04-10 16:02:45 +02:00
parent dedd815770
commit 80a5d6ed6a
3 changed files with 11 additions and 4 deletions

View File

@@ -371,9 +371,16 @@ export function insertNewGridItem(
let parent = findGridItemById(app.grid, app.subgrids, key)?.data
let subgrids = parent?.numberOfSubgrids
if (subgrids === undefined) {
throw Error(`Invalid subgrid selected, the parent has no subgrids: ${key}, parent: ${JSON.stringify(parent)}`)
throw Error(
`Invalid subgrid selected, the parent has no subgrids: ${key}, parent: ${JSON.stringify(
parent
)}`
)
}
if (focusedGrid?.subGridIndex && (focusedGrid?.subGridIndex < 0 || focusedGrid?.subGridIndex >= subgrids)) {
if (
focusedGrid?.subGridIndex &&
(focusedGrid?.subGridIndex < 0 || focusedGrid?.subGridIndex >= subgrids)
) {
throw Error(`Invalid subgrid selected: ${key}, max subgrids: ${subgrids}`)
}
// If ever the subgrid is undefined, we want to make sure it is defined

View File

@@ -29,7 +29,7 @@
...componentInput,
type: 'evalv2',
expr: expr,
connections: [{ componentId: connection.componentId, id: connection.path.split('.')[0] }]
connections: [{ componentId: connection.componentId, id: connection.path.split('.')[0].split('[')[0] }]
}
evalV2editor?.setCode(expr)
$app = $app

View File

@@ -52,7 +52,7 @@
...componentInput,
type: 'evalv2',
expr: expr,
connections: [{ componentId: connection.componentId, id: connection.path.split('.')[0] }]
connections: [{ componentId: connection.componentId, id: connection.path.split('.')[0].split('[')[0] }]
}
evalV2editor?.setCode(expr)
$app = $app