Skip to content

Commit

Permalink
fix unique key
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenthoms committed Sep 13, 2024
1 parent edce812 commit 5bd7d3f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
11 changes: 8 additions & 3 deletions frontend/src/lib/components/SortableList/sortableList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const SortableListContext = React.createContext<SortableListContextType>(
});

export type SortableListProps = {
contentWhenEmpty?: React.ReactNode;
contentWhenEmpty?: React.ReactElement;
children: React.ReactElement<SortableListItemProps | SortableListGroupProps>[];
isMoveAllowed?: (args: IsMoveAllowedArgs) => boolean;
onItemMoved?: (
Expand Down Expand Up @@ -505,11 +505,16 @@ export function SortableList(props: SortableListProps): React.ReactNode {
}

function makeChildren(): React.ReactNode[] {
const children: React.ReactNode[] = [];
if (props.children.length === 0 && props.contentWhenEmpty) {
return [props.contentWhenEmpty];
children.push(
React.cloneElement(props.contentWhenEmpty, {
key: "contentWhenEmpty",
})
);
return children;
}

const children: React.ReactNode[] = [];
for (const child of props.children) {
if (typeof child.type === "string") {
continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ export class LayerDelegate<TSettings extends Settings, TData>
this.setStatus(LayerStatus.SUCCESS);
} catch (error: any) {
if (error.constructor?.name === "CancelledError") {
this.setStatus(LayerStatus.IDLE);
return;
}
const apiError = ApiErrorHelper.fromError(error);
Expand Down

0 comments on commit 5bd7d3f

Please sign in to comment.