@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.
@@ -4083,10 +4083,15 @@ var __publicField = (obj, key, value) => {
4083
4083
  if (!assetToBeDeleted)
4084
4084
  throw new Error(`No asset with id ${assetId} found in the store`);
4085
4085
  const attachmentsOfAssets = selectAttachmentsOfAsset(assetId)(store.getState());
4086
- store.dispatch(deleteAsset(assetId));
4086
+ const formSubmissionsOfAssets = selectFormSubmissionsOfAsset(assetId)(store.getState());
4087
+ this.dispatch(deleteAsset(assetId));
4087
4088
  if (attachmentsOfAssets.length > 0) {
4088
4089
  const attachmentsOfAssetIds = attachmentsOfAssets.map(({ offline_id }) => offline_id);
4089
- store.dispatch(deleteAssetAttachments(attachmentsOfAssetIds));
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));
4090
4095
  }
4091
4096
  return this.enqueueRequest({
4092
4097
  description: "Delete asset",
@@ -4095,8 +4100,9 @@ var __publicField = (obj, key, value) => {
4095
4100
  blockers: [assetId],
4096
4101
  blocks: []
4097
4102
  }).catch((err) => {
4098
- store.dispatch(addAsset(assetToBeDeleted));
4099
- store.dispatch(addAssetAttachments(attachmentsOfAssets));
4103
+ this.dispatch(addAsset(assetToBeDeleted));
4104
+ this.dispatch(addAssetAttachments(attachmentsOfAssets));
4105
+ this.dispatch(addFormSubmissions(formSubmissionsOfAssets));
4100
4106
  throw err;
4101
4107
  });
4102
4108
  }
@@ -4971,12 +4977,15 @@ var __publicField = (obj, key, value) => {
4971
4977
  }
4972
4978
  const attachmentsOfIssue = selectAttachmentsOfIssue(id)(state);
4973
4979
  const updatesOfIssue = selectIssueUpdatesOfIssue(id)(state);
4980
+ const formSubmissionsOfIssue = selectFormSubmissionsOfIssue(id)(state);
4974
4981
  this.dispatch(deleteIssue(id));
4975
4982
  this.dispatch(addActiveProjectIssuesCount(-1));
4976
4983
  if (attachmentsOfIssue.length > 0)
4977
4984
  this.dispatch(deleteIssueAttachments(attachmentsOfIssue.map(({ offline_id }) => offline_id)));
4978
4985
  if (updatesOfIssue.length > 0)
4979
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)));
4980
4989
  try {
4981
4990
  return await this.enqueueRequest({
4982
4991
  description: "Delete issue",
@@ -4990,6 +4999,7 @@ var __publicField = (obj, key, value) => {
4990
4999
  this.dispatch(addIssueAttachments(attachmentsOfIssue));
4991
5000
  this.dispatch(addIssueUpdates(updatesOfIssue));
4992
5001
  this.dispatch(addActiveProjectIssuesCount(1));
5002
+ this.dispatch(addFormSubmissions(formSubmissionsOfIssue));
4993
5003
  throw e;
4994
5004
  }
4995
5005
  }