forked from github/plane
fix: edit object modal
This commit is contained in:
parent
c714b5e50c
commit
4a13b30874
@ -39,7 +39,11 @@ export const TypesDropdown: React.FC<Props> = ({ onClick }) => {
|
|||||||
<Plus size={14} strokeWidth={1.5} />
|
<Plus size={14} strokeWidth={1.5} />
|
||||||
Add Attribute
|
Add Attribute
|
||||||
</Menu.Button>
|
</Menu.Button>
|
||||||
<div className={`${open ? "fixed z-20 top-0 left-0 h-full w-full cursor-auto" : ""}`}>
|
<div
|
||||||
|
className={`${
|
||||||
|
open ? "" : "hidden"
|
||||||
|
} fixed z-20 top-0 left-0 h-full w-full cursor-auto`}
|
||||||
|
>
|
||||||
<Menu.Items
|
<Menu.Items
|
||||||
ref={optionsRef}
|
ref={optionsRef}
|
||||||
className="fixed z-10 border-[0.5px] border-custom-border-300 p-1 min-w-[10rem] max-h-60 rounded bg-custom-background-100 text-xs shadow-custom-shadow-rg focus:outline-none overflow-y-auto"
|
className="fixed z-10 border-[0.5px] border-custom-border-300 p-1 min-w-[10rem] max-h-60 rounded bg-custom-background-100 text-xs shadow-custom-shadow-rg focus:outline-none overflow-y-auto"
|
||||||
|
@ -110,8 +110,13 @@ export const ObjectModal: React.FC<Props> = observer(
|
|||||||
if (!workspaceSlug) return;
|
if (!workspaceSlug) return;
|
||||||
|
|
||||||
customAttributes.fetchEntityDetails(workspaceSlug.toString(), object.id).then((res) => {
|
customAttributes.fetchEntityDetails(workspaceSlug.toString(), object.id).then((res) => {
|
||||||
setObject({ ...res });
|
setObject((prev) => ({ ...prev, ...res }));
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
setObject((prev) => ({
|
||||||
|
...prev,
|
||||||
|
...customAttributes.entities?.find((e) => e.id === object.id),
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
}, [customAttributes, object.id, workspaceSlug]);
|
}, [customAttributes, object.id, workspaceSlug]);
|
||||||
|
|
||||||
@ -119,8 +124,8 @@ export const ObjectModal: React.FC<Props> = observer(
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!objectIdToEdit) return;
|
if (!objectIdToEdit) return;
|
||||||
|
|
||||||
setObject((prevData) => ({
|
setObject((prev) => ({
|
||||||
...prevData,
|
...prev,
|
||||||
id: objectIdToEdit,
|
id: objectIdToEdit,
|
||||||
}));
|
}));
|
||||||
}, [objectIdToEdit]);
|
}, [objectIdToEdit]);
|
||||||
|
@ -8,7 +8,7 @@ import type { ICustomAttribute } from "types";
|
|||||||
class CustomAttributesStore {
|
class CustomAttributesStore {
|
||||||
entities: ICustomAttribute[] | null = null;
|
entities: ICustomAttribute[] | null = null;
|
||||||
entityAttributes: {
|
entityAttributes: {
|
||||||
[key: string]: { [key: string]: ICustomAttribute };
|
[entityId: string]: { [entityAttributeId: string]: ICustomAttribute };
|
||||||
} = {};
|
} = {};
|
||||||
// loaders
|
// loaders
|
||||||
fetchEntitiesLoader = false;
|
fetchEntitiesLoader = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user