diff --git a/backend/src/Designer/Models/LayoutSets.cs b/backend/src/Designer/Models/LayoutSets.cs index 1d19842bbc8..9efb83fba5a 100644 --- a/backend/src/Designer/Models/LayoutSets.cs +++ b/backend/src/Designer/Models/LayoutSets.cs @@ -23,10 +23,12 @@ public class LayoutSetConfig public string Id { get; set; } [JsonPropertyName("dataType")] - [CanBeNull] public string DataType { get; set; } + [CanBeNull] + public string DataType { get; set; } [JsonPropertyName("tasks")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [CanBeNull] public List Tasks { get; set; } [JsonPropertyName("type")] diff --git a/backend/src/Designer/Services/Implementation/AppDevelopmentService.cs b/backend/src/Designer/Services/Implementation/AppDevelopmentService.cs index 9f59ec42bdf..34177cd0c6d 100644 --- a/backend/src/Designer/Services/Implementation/AppDevelopmentService.cs +++ b/backend/src/Designer/Services/Implementation/AppDevelopmentService.cs @@ -305,7 +305,7 @@ public async Task AddLayoutSet(AltinnRepoEditingContext altinnRepoEd { throw new NonUniqueLayoutSetIdException($"Layout set name, {newLayoutSet.Id}, already exists."); } - if (newLayoutSet.Tasks != null && layoutSets.Sets.Exists(set => set.Tasks[0] == newLayoutSet.Tasks[0])) + if (newLayoutSet.Tasks != null && layoutSets.Sets.Exists(set => set.Tasks?[0] == newLayoutSet.Tasks[0])) { throw new NonUniqueTaskForLayoutSetException($"Layout set with task, {newLayoutSet.Tasks[0]}, already exists."); } diff --git a/frontend/app-development/features/processEditor/bpmnHandlerUtils/bpmnHandlerUtils.ts b/frontend/app-development/features/processEditor/bpmnHandlerUtils/bpmnHandlerUtils.ts index 4ea9be4742c..708927a83f4 100644 --- a/frontend/app-development/features/processEditor/bpmnHandlerUtils/bpmnHandlerUtils.ts +++ b/frontend/app-development/features/processEditor/bpmnHandlerUtils/bpmnHandlerUtils.ts @@ -1,6 +1,6 @@ import type { LayoutSets } from 'app-shared/types/api/LayoutSetsResponse'; export const getLayoutSetIdFromTaskId = (elementId: string, layoutSets: LayoutSets) => { - const layoutSet = layoutSets.sets.find((set) => set.tasks[0] === elementId); + const layoutSet = layoutSets.sets.find((set) => set.tasks && set.tasks[0] === elementId); return layoutSet?.id; }; diff --git a/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/ConfigContent.tsx b/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/ConfigContent.tsx index 7f9c51e7b89..b99cb379853 100644 --- a/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/ConfigContent.tsx +++ b/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/ConfigContent.tsx @@ -20,11 +20,13 @@ export const ConfigContent = (): React.ReactElement => { const { t } = useTranslation(); const { bpmnDetails } = useBpmnContext(); const { layoutSets, availableDataModelIds } = useBpmnApiContext(); - const layoutSet = layoutSets?.sets.find((set) => set.tasks.includes(bpmnDetails.id)); + const layoutSet = layoutSets?.sets.find((set) => set.tasks?.includes(bpmnDetails.id)); const existingDataTypeForTask = layoutSet?.dataType; const isSigningTask = bpmnDetails.taskType === 'signing'; - const taskHasConnectedLayoutSet = layoutSets?.sets?.some((set) => set.tasks[0] == bpmnDetails.id); + const taskHasConnectedLayoutSet = layoutSets?.sets?.some( + (set) => set.tasks && set.tasks[0] == bpmnDetails.id, + ); const { shouldDisplayAction } = useStudioRecommendedNextActionContext(); const studioModeler = new StudioModeler();