Skip to content

Commit

Permalink
Minor
Browse files Browse the repository at this point in the history
  • Loading branch information
fgatti675 committed Apr 23, 2024
1 parent 2eb3dff commit 3b87a6d
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@ import React, { useCallback, useState } from "react";
import { AddIcon, Button, Paper, Typography } from "@firecms/ui";
import { getIn, useFormex } from "@firecms/formex";
import { PropertyFormDialog } from "../PropertyEditView";
import { getFullId, idToPropertiesPath, namespaceToPropertiesOrderPath } from "../util";
import { getFullId, idToPropertiesPath, namespaceToPropertiesOrderPath, namespaceToPropertiesPath } from "../util";
import { PropertyTree } from "../PropertyTree";
import { ArrayProperty, Property, PropertyConfig } from "@firecms/core";

export function BlockPropertyField({ disabled, getData, allowDataInference, propertyConfigs, collectionEditable }: {
export function BlockPropertyField({
disabled,
getData,
allowDataInference,
propertyConfigs,
collectionEditable
}: {
disabled: boolean;
getData?: () => Promise<object[]>;
allowDataInference: boolean;
Expand Down Expand Up @@ -50,7 +56,7 @@ export function BlockPropertyField({ disabled, getData, allowDataInference, prop

setFieldValue(`oneOf.${idToPropertiesPath(fullId)}`, undefined, false);
const propertiesOrderPath = `oneOf.${namespaceToPropertiesOrderPath(namespace)}`;
const currentPropertiesOrder: string[] = getIn(values, propertiesOrderPath);
const currentPropertiesOrder: string[] = getIn(values, propertiesOrderPath) ?? Object.keys(getIn(values, namespaceToPropertiesPath(namespace)));
setFieldValue(propertiesOrderPath, currentPropertiesOrder.filter((p) => p !== propertyKey), false);

setPropertyDialogOpen(false);
Expand Down

0 comments on commit 3b87a6d

Please sign in to comment.