Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Error occuring when adding a data task after creating a subform #13736

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion backend/src/Designer/Models/LayoutSets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@
public class LayoutSetConfig
{
[JsonPropertyName("id")]
public string Id { get; set; }

Check warning on line 23 in backend/src/Designer/Models/LayoutSets.cs

View workflow job for this annotation

GitHub Actions / Run dotnet build and test (windows-latest)

Non-nullable property 'Id' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

Check warning on line 23 in backend/src/Designer/Models/LayoutSets.cs

View workflow job for this annotation

GitHub Actions / Run dotnet build and test (macos-latest)

Non-nullable property 'Id' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

[JsonPropertyName("dataType")]
[CanBeNull] public string DataType { get; set; }
[CanBeNull]
public string DataType { get; set; }

[JsonPropertyName("tasks")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[CanBeNull]
public List<string> Tasks { get; set; }

[JsonPropertyName("type")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ public async Task<LayoutSets> 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.");
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
};
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Loading