fix(frontend): Correctly handle undefined actions

This commit is contained in:
Faton Ramadani
2024-04-12 16:14:13 +02:00
parent 6e87e089ac
commit c037117708
3 changed files with 9 additions and 3 deletions
@@ -184,7 +184,10 @@
if (c.type === 'tablecomponent') {
r.push(...c.actionButtons.map((x) => ({ input: x.componentInput, id: x.id })))
}
if (c.type === 'aggridcomponent' || c.type === 'aggridcomponentee') {
if (
(c.type === 'aggridcomponent' || c.type === 'aggridcomponentee') &&
Array.isArray(c.actions)
) {
r.push(...c.actions.map((x) => ({ input: x.componentInput, id: x.id })))
}
if (c.type === 'menucomponent') {
@@ -170,7 +170,10 @@ export function allsubIds(app: App, parentId: string): string[] {
if (item.data.type === 'tablecomponent') {
subIds.push(...item.data.actionButtons?.map((x) => x.id))
}
if (item.data.type === 'aggridcomponent' || item.data.type === 'aggridcomponentee') {
if (
item.data.type === 'aggridcomponent' ||
(item.data.type === 'aggridcomponentee' && Array.isArray(item.data.actions))
) {
subIds.push(...item.data.actions?.map((x) => x.id))
}
if (item.data.type === 'menucomponent') {
@@ -35,7 +35,7 @@
{/if}
{#if gridItem?.data?.type === 'aggridcomponent' || (gridItem?.data?.type === 'aggridcomponentee' && Array.isArray(gridItem.data.actions))}
{#each gridItem.data.actions as actionButton, index (index)}
{#each gridItem.data.actions ?? [] as actionButton, index (index)}
{#if actionButton?.id === $selectedComponentInEditor || actionButton?.id + '_transformer' === $selectedComponentInEditor}
<InlineScriptEditorPanel
on:createScriptFromInlineScript