@overmap-ai/core 1.0.62-store-clear-fixes.1 → 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.
package/dist/overmap-core.js
CHANGED
|
@@ -4095,10 +4095,15 @@ class AssetService extends BaseApiService {
|
|
|
4095
4095
|
if (!assetToBeDeleted)
|
|
4096
4096
|
throw new Error(`No asset with id ${assetId} found in the store`);
|
|
4097
4097
|
const attachmentsOfAssets = selectAttachmentsOfAsset(assetId)(store.getState());
|
|
4098
|
-
store.
|
|
4098
|
+
const formSubmissionsOfAssets = selectFormSubmissionsOfAsset(assetId)(store.getState());
|
|
4099
|
+
this.dispatch(deleteAsset(assetId));
|
|
4099
4100
|
if (attachmentsOfAssets.length > 0) {
|
|
4100
4101
|
const attachmentsOfAssetIds = attachmentsOfAssets.map(({ offline_id }) => offline_id);
|
|
4101
|
-
|
|
4102
|
+
this.dispatch(deleteAssetAttachments(attachmentsOfAssetIds));
|
|
4103
|
+
}
|
|
4104
|
+
if (formSubmissionsOfAssets.length > 0) {
|
|
4105
|
+
const formSubmissionsOfAssetIds = formSubmissionsOfAssets.map(({ offline_id }) => offline_id);
|
|
4106
|
+
this.dispatch(deleteFormSubmissions(formSubmissionsOfAssetIds));
|
|
4102
4107
|
}
|
|
4103
4108
|
return this.enqueueRequest({
|
|
4104
4109
|
description: "Delete asset",
|
|
@@ -4107,8 +4112,9 @@ class AssetService extends BaseApiService {
|
|
|
4107
4112
|
blockers: [assetId],
|
|
4108
4113
|
blocks: []
|
|
4109
4114
|
}).catch((err) => {
|
|
4110
|
-
|
|
4111
|
-
|
|
4115
|
+
this.dispatch(addAsset(assetToBeDeleted));
|
|
4116
|
+
this.dispatch(addAssetAttachments(attachmentsOfAssets));
|
|
4117
|
+
this.dispatch(addFormSubmissions(formSubmissionsOfAssets));
|
|
4112
4118
|
throw err;
|
|
4113
4119
|
});
|
|
4114
4120
|
}
|
|
@@ -4983,12 +4989,15 @@ class IssueService extends BaseApiService {
|
|
|
4983
4989
|
}
|
|
4984
4990
|
const attachmentsOfIssue = selectAttachmentsOfIssue(id)(state);
|
|
4985
4991
|
const updatesOfIssue = selectIssueUpdatesOfIssue(id)(state);
|
|
4992
|
+
const formSubmissionsOfIssue = selectFormSubmissionsOfIssue(id)(state);
|
|
4986
4993
|
this.dispatch(deleteIssue(id));
|
|
4987
4994
|
this.dispatch(addActiveProjectIssuesCount(-1));
|
|
4988
4995
|
if (attachmentsOfIssue.length > 0)
|
|
4989
4996
|
this.dispatch(deleteIssueAttachments(attachmentsOfIssue.map(({ offline_id }) => offline_id)));
|
|
4990
4997
|
if (updatesOfIssue.length > 0)
|
|
4991
4998
|
this.dispatch(deleteIssueUpdates(updatesOfIssue.map(({ offline_id }) => offline_id)));
|
|
4999
|
+
if (formSubmissionsOfIssue.length > 0)
|
|
5000
|
+
this.dispatch(deleteFormSubmissions(formSubmissionsOfIssue.map(({ offline_id }) => offline_id)));
|
|
4992
5001
|
try {
|
|
4993
5002
|
return await this.enqueueRequest({
|
|
4994
5003
|
description: "Delete issue",
|
|
@@ -5002,6 +5011,7 @@ class IssueService extends BaseApiService {
|
|
|
5002
5011
|
this.dispatch(addIssueAttachments(attachmentsOfIssue));
|
|
5003
5012
|
this.dispatch(addIssueUpdates(updatesOfIssue));
|
|
5004
5013
|
this.dispatch(addActiveProjectIssuesCount(1));
|
|
5014
|
+
this.dispatch(addFormSubmissions(formSubmissionsOfIssue));
|
|
5005
5015
|
throw e;
|
|
5006
5016
|
}
|
|
5007
5017
|
}
|