Skip to content

Commit

Permalink
Clicking 'add metadata' when files are uploading breaks the metadata (#…
Browse files Browse the repository at this point in the history
…341)

* one liner fix

* remove unused library
  • Loading branch information
StefanBabukov authored Jun 18, 2021
1 parent f263f66 commit bbb461a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/components/data-management/ProjectDetails.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,6 @@ const ProjectDetails = ({ width, height }) => {

const createMetadataColumn = () => {
const key = temporaryMetadataKey(tableColumns);

const metadataColumn = {
key,
fixed: 'right',
Expand All @@ -289,6 +288,7 @@ const ProjectDetails = ({ width, height }) => {
existingMetadata={activeProject.metadataKeys}
onCreate={(name) => {
const newMetadataColumn = createInitializedMetadataColumn(name);

setTableColumns([...tableColumns, newMetadataColumn]);
dispatch(createMetadataTrack(name, activeProjectUuid));

Expand All @@ -311,7 +311,6 @@ const ProjectDetails = ({ width, height }) => {

setTableColumns([...tableColumns, metadataColumn]);
};

const deleteMetadataColumn = (name) => {
setTableColumns([...tableColumns.filter((entryName) => entryName !== name)]);
dispatch(deleteMetadataTrack(name, activeProjectUuid));
Expand Down Expand Up @@ -488,13 +487,14 @@ const ProjectDetails = ({ width, height }) => {
setTableColumns([]);
return;
}

// Set table columns
const metadataColumns = activeProject?.metadataKeys.map(
(metadataKey) => createInitializedMetadataColumn(metadataKeyToName(metadataKey)),
) || [];

setTableColumns([...columns, ...metadataColumns]);
const newColumns = tableColumns.length ? tableColumns : [...columns, ...metadataColumns];

setTableColumns(newColumns);
// Set table data

const newData = activeProject.samples.map((sampleUuid, idx) => {
Expand Down

0 comments on commit bbb461a

Please sign in to comment.