Skip to content

Commit

Permalink
Merge pull request #1756 from sennetconsortium/tjmadonna/1751-epicoll…
Browse files Browse the repository at this point in the history
…ections-create-fix

Tjmadonna/1751 epicollections create fix
  • Loading branch information
maxsibilla authored Nov 21, 2024
2 parents b7572e8 + 42afda5 commit 2a9c2ce
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
10 changes: 6 additions & 4 deletions src/components/custom/entities/collection/EditCollection.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,10 @@ const EntityHeader = dynamic(() => import('@/components/custom/layout/entity/Hea
const EntityFormGroup = dynamic(() => import('@/components/custom/layout/entity/FormGroup'))
const GroupSelect = dynamic(() => import("@/components/custom/edit/GroupSelect"))
const Header = dynamic(() => import("@/components/custom/layout/Header"))
const NotFound = dynamic(() => import("@/components/custom/NotFound"))

export default function EditCollection({collectionType='Collection', entitiesTableLabel='Entities', entitiesButtonLabel='entity'}) {
const {
isPreview, isAuthorizing, getModal, setModalDetails,
isPreview, getModal, setModalDetails,
data, setData,
error, setError,
values, setValues,
Expand Down Expand Up @@ -173,6 +172,11 @@ export default function EditCollection({collectionType='Collection', entitiesTab
}
} else {
if (supportedEntities.includes(entity.entity_type)) {
// delete the entity if it already exists, append the new one
let idx = newDatasets.findIndex((d) => d.uuid === entity.uuid)
if (idx > -1) {
newDatasets.splice(idx, 1)
}
newDatasets.push(entity)
} else {
if (isBulkHandling.current) {
Expand Down Expand Up @@ -225,7 +229,6 @@ export default function EditCollection({collectionType='Collection', entitiesTab
log.debug("Form is invalid")
setDisableSubmit(false);
} else {

event.preventDefault();
if (values['entity_uuids'] === undefined || values['entity_uuids'].length === 0) {
event.stopPropagation();
Expand All @@ -234,7 +237,6 @@ export default function EditCollection({collectionType='Collection', entitiesTab

log.debug("Form is valid")


if (!_.isEmpty(contributors) && contributors.description.records) {
values["contributors"] = contributors.description.records
values['contacts'] = contacts.description.records
Expand Down
3 changes: 1 addition & 2 deletions src/pages/edit/epicollection.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import dynamic from "next/dynamic";
import {EntityProvider} from "@/context/EntityContext";
import React, {useEffect} from "react";
import {valid_dataset_ancestor_config} from "@/config/config";
import React from "react";

const EditCollection = dynamic(() => import("@/components/custom/entities/collection/EditCollection.jsx"))

Expand Down

0 comments on commit 2a9c2ce

Please sign in to comment.