@overmap-ai/core 1.0.62-store-clear-fixes.0 → 1.0.62-store-clear-fixes.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -2510,11 +2510,16 @@ var __publicField = (obj, key, value) => {
|
|
|
2510
2510
|
};
|
|
2511
2511
|
const selectFormSubmissionsOfForm = restructureCreateSelectorWithArgs(
|
|
2512
2512
|
toolkit.createSelector(
|
|
2513
|
-
[
|
|
2513
|
+
[
|
|
2514
|
+
selectFormSubmissionsMapping,
|
|
2515
|
+
selectFormRevisionMapping,
|
|
2516
|
+
(_state, formId) => formId
|
|
2517
|
+
],
|
|
2514
2518
|
(submissions, revisionMapping, formId) => {
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2519
|
+
const revisionsOfForm = Object.values(revisionMapping).filter((revision) => revision.form === formId);
|
|
2520
|
+
const revisionIds = new Set(revisionsOfForm.map((revision) => revision.offline_id));
|
|
2521
|
+
return Object.values(submissions).filter((submission) => {
|
|
2522
|
+
return revisionIds.has(submission.form_revision);
|
|
2518
2523
|
});
|
|
2519
2524
|
}
|
|
2520
2525
|
)
|
|
@@ -4078,10 +4083,15 @@ var __publicField = (obj, key, value) => {
|
|
|
4078
4083
|
if (!assetToBeDeleted)
|
|
4079
4084
|
throw new Error(`No asset with id ${assetId} found in the store`);
|
|
4080
4085
|
const attachmentsOfAssets = selectAttachmentsOfAsset(assetId)(store.getState());
|
|
4081
|
-
store.
|
|
4086
|
+
const formSubmissionsOfAssets = selectFormSubmissionsOfAsset(assetId)(store.getState());
|
|
4087
|
+
this.dispatch(deleteAsset(assetId));
|
|
4082
4088
|
if (attachmentsOfAssets.length > 0) {
|
|
4083
4089
|
const attachmentsOfAssetIds = attachmentsOfAssets.map(({ offline_id }) => offline_id);
|
|
4084
|
-
|
|
4090
|
+
this.dispatch(deleteAssetAttachments(attachmentsOfAssetIds));
|
|
4091
|
+
}
|
|
4092
|
+
if (formSubmissionsOfAssets.length > 0) {
|
|
4093
|
+
const formSubmissionsOfAssetIds = formSubmissionsOfAssets.map(({ offline_id }) => offline_id);
|
|
4094
|
+
this.dispatch(deleteFormSubmissions(formSubmissionsOfAssetIds));
|
|
4085
4095
|
}
|
|
4086
4096
|
return this.enqueueRequest({
|
|
4087
4097
|
description: "Delete asset",
|
|
@@ -4090,8 +4100,9 @@ var __publicField = (obj, key, value) => {
|
|
|
4090
4100
|
blockers: [assetId],
|
|
4091
4101
|
blocks: []
|
|
4092
4102
|
}).catch((err) => {
|
|
4093
|
-
|
|
4094
|
-
|
|
4103
|
+
this.dispatch(addAsset(assetToBeDeleted));
|
|
4104
|
+
this.dispatch(addAssetAttachments(attachmentsOfAssets));
|
|
4105
|
+
this.dispatch(addFormSubmissions(formSubmissionsOfAssets));
|
|
4095
4106
|
throw err;
|
|
4096
4107
|
});
|
|
4097
4108
|
}
|
|
@@ -4966,12 +4977,15 @@ var __publicField = (obj, key, value) => {
|
|
|
4966
4977
|
}
|
|
4967
4978
|
const attachmentsOfIssue = selectAttachmentsOfIssue(id)(state);
|
|
4968
4979
|
const updatesOfIssue = selectIssueUpdatesOfIssue(id)(state);
|
|
4980
|
+
const formSubmissionsOfIssue = selectFormSubmissionsOfIssue(id)(state);
|
|
4969
4981
|
this.dispatch(deleteIssue(id));
|
|
4970
4982
|
this.dispatch(addActiveProjectIssuesCount(-1));
|
|
4971
4983
|
if (attachmentsOfIssue.length > 0)
|
|
4972
4984
|
this.dispatch(deleteIssueAttachments(attachmentsOfIssue.map(({ offline_id }) => offline_id)));
|
|
4973
4985
|
if (updatesOfIssue.length > 0)
|
|
4974
4986
|
this.dispatch(deleteIssueUpdates(updatesOfIssue.map(({ offline_id }) => offline_id)));
|
|
4987
|
+
if (formSubmissionsOfIssue.length > 0)
|
|
4988
|
+
this.dispatch(deleteFormSubmissions(formSubmissionsOfIssue.map(({ offline_id }) => offline_id)));
|
|
4975
4989
|
try {
|
|
4976
4990
|
return await this.enqueueRequest({
|
|
4977
4991
|
description: "Delete issue",
|
|
@@ -4985,6 +4999,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4985
4999
|
this.dispatch(addIssueAttachments(attachmentsOfIssue));
|
|
4986
5000
|
this.dispatch(addIssueUpdates(updatesOfIssue));
|
|
4987
5001
|
this.dispatch(addActiveProjectIssuesCount(1));
|
|
5002
|
+
this.dispatch(addFormSubmissions(formSubmissionsOfIssue));
|
|
4988
5003
|
throw e;
|
|
4989
5004
|
}
|
|
4990
5005
|
}
|