From df1da93b2ab32821753e1cfd17dbd065d3c35c40 Mon Sep 17 00:00:00 2001 From: Martin Fosco Date: Mon, 14 Jun 2021 04:29:41 -0300 Subject: [PATCH] [BIOMAGE-1109] Fix metadata not saving (#329) * Remove no longer used sample ids and remove properties that aren't samples from the updates * Remove samples extra loading * Fix tsts * Fix --- .../redux/reducers/__snapshots__/samplesReducer.test.js.snap | 1 - src/redux/actions/projects/createMetadataTrack.js | 4 +++- src/redux/actions/projects/deleteMetadataTrack.js | 4 +--- src/redux/actions/projects/updateMetadataTrack.js | 4 +--- src/redux/reducers/samples/samplesLoaded.js | 1 - 5 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/__test__/redux/reducers/__snapshots__/samplesReducer.test.js.snap b/src/__test__/redux/reducers/__snapshots__/samplesReducer.test.js.snap index 9e607bb19d..c6a005f543 100644 --- a/src/__test__/redux/reducers/__snapshots__/samplesReducer.test.js.snap +++ b/src/__test__/redux/reducers/__snapshots__/samplesReducer.test.js.snap @@ -171,7 +171,6 @@ Object { "asd123", "qwe234", ], - "loading": false, "meta": Object { "error": false, "loading": false, diff --git a/src/redux/actions/projects/createMetadataTrack.js b/src/redux/actions/projects/createMetadataTrack.js index a14f83bf97..483c21d8c4 100644 --- a/src/redux/actions/projects/createMetadataTrack.js +++ b/src/redux/actions/projects/createMetadataTrack.js @@ -36,7 +36,9 @@ const createMetadataTrack = ( }, }); - await Promise.all(Object.entries(samples).map(([sampleUuid, sample]) => dispatch({ + const { meta, loading, ...onlySamples } = samples; + + await Promise.all(Object.entries(onlySamples).map(([sampleUuid, sample]) => dispatch({ type: SAMPLES_UPDATE, payload: { sampleUuid, diff --git a/src/redux/actions/projects/deleteMetadataTrack.js b/src/redux/actions/projects/deleteMetadataTrack.js index 3ff5c061b2..a99bd03122 100644 --- a/src/redux/actions/projects/deleteMetadataTrack.js +++ b/src/redux/actions/projects/deleteMetadataTrack.js @@ -31,9 +31,7 @@ const deleteMetadataTrack = ( ...curr, [sampleUuid]: updatedSample, }; - }, { - ids: project.samples, - }); + }, {}); try { await dispatch(saveProject(projectUuid, newProject, false)); diff --git a/src/redux/actions/projects/updateMetadataTrack.js b/src/redux/actions/projects/updateMetadataTrack.js index 3ee0c1998e..6c03366e26 100644 --- a/src/redux/actions/projects/updateMetadataTrack.js +++ b/src/redux/actions/projects/updateMetadataTrack.js @@ -37,9 +37,7 @@ const updateMetadataTrack = ( ...curr, [sampleUuid]: updatedSample, }; - }, { - ids: project.samples, - }); + }, {}); try { await dispatch(saveProject(projectUuid, newProject, false)); diff --git a/src/redux/reducers/samples/samplesLoaded.js b/src/redux/reducers/samples/samplesLoaded.js index 7c4954e210..8253a34ec3 100644 --- a/src/redux/reducers/samples/samplesLoaded.js +++ b/src/redux/reducers/samples/samplesLoaded.js @@ -2,7 +2,6 @@ const samplesLoad = (state, action) => { const { samples } = action.payload; return { ...state, - loading: false, meta: { ...state.meta, loading: false,