Skip to content

Commit

Permalink
Fix bug when deleting exclusive option
Browse files Browse the repository at this point in the history
  • Loading branch information
jamdelion committed Jan 8, 2025
1 parent 1f020b3 commit 2247f2f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export const ExclusiveOrOptionManager = ({
if (grouped) {
const exclusiveOptionGroup = {
title: "Or",
exclusive: true,
children: newExclusiveOptions,
};
const newCombinedOptions = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export const partitionGroupedOptions = (
const [exclusiveOptionGroup, nonExclusiveOptionGroups] = partition(
groupedOptions,
(group: Group<Option>) =>
group.exclusive ||
group.children.some((child) => child.data.exclusive === true),
);
return [exclusiveOptionGroup, nonExclusiveOptionGroups];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ export const groupedOptionsWithExclusiveOption: Array<Group<Option>> = [
},
{
title: "Exclusive 'Or' Option",
exclusive: true,
children: [
{
id: "exclusive_option",
Expand Down
1 change: 1 addition & 0 deletions editor.planx.uk/src/@planx/components/Checklist/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export enum ChecklistLayout {

export interface Group<T> {
title: string;
exclusive?: true;
children: Array<T>;
}

Expand Down

0 comments on commit 2247f2f

Please sign in to comment.