@overmap-ai/core 1.0.44-tiptap.5 → 1.0.44-tiptap.7

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.
@@ -1684,8 +1684,14 @@ const selectAttachmentsOfComponentByType = restructureCreateSelectorWithArgs(
1684
1684
  [selectAllComponentAttachments, (_state, componentId) => componentId],
1685
1685
  (attachments, componentId) => {
1686
1686
  const attachmentsOfComponent = attachments.filter(({ component_id }) => componentId === component_id);
1687
- const fileAttachments = attachmentsOfComponent.filter(({ file_type }) => !file_type.startsWith("image/"));
1688
- const imageAttachments = attachmentsOfComponent.filter(({ file_type }) => file_type.startsWith("image/"));
1687
+ const fileAttachments = attachmentsOfComponent.filter(
1688
+ // this null check here is necessary, there are cases where file_type is null or undefined
1689
+ ({ file_type }) => !file_type || !file_type.startsWith("image/")
1690
+ );
1691
+ const imageAttachments = attachmentsOfComponent.filter(
1692
+ // this null check here is necessary, there are cases where file_type is null or undefined
1693
+ ({ file_type }) => file_type && file_type.startsWith("image/")
1694
+ );
1689
1695
  return { fileAttachments, imageAttachments };
1690
1696
  }
1691
1697
  )
@@ -1950,8 +1956,14 @@ const selectAttachmentsOfComponentTypeByType = restructureCreateSelectorWithArgs
1950
1956
  const attachmentsOfComponent = attachments.filter(
1951
1957
  ({ component_type_id }) => component_type_id === componentTypeId
1952
1958
  );
1953
- const fileAttachments = attachmentsOfComponent.filter(({ file_type }) => !file_type.startsWith("image/"));
1954
- const imageAttachments = attachmentsOfComponent.filter(({ file_type }) => file_type.startsWith("image/"));
1959
+ const fileAttachments = attachmentsOfComponent.filter(
1960
+ // this null check here is necessary, there are cases where file_type is null or undefined
1961
+ ({ file_type }) => !file_type || !file_type.startsWith("image/")
1962
+ );
1963
+ const imageAttachments = attachmentsOfComponent.filter(
1964
+ // this null check here is necessary, there are cases where file_type is null or undefined
1965
+ ({ file_type }) => file_type && file_type.startsWith("image/")
1966
+ );
1955
1967
  return { fileAttachments, imageAttachments };
1956
1968
  }
1957
1969
  )
@@ -2251,8 +2263,14 @@ const selectAttachmentsOfIssueByType = restructureCreateSelectorWithArgs(
2251
2263
  [selectIssueAttachments, (_state, issueId) => issueId],
2252
2264
  (attachments, issueId) => {
2253
2265
  const attachmentsOfComponent = attachments.filter(({ issue_id }) => issue_id === issueId);
2254
- const fileAttachments = attachmentsOfComponent.filter(({ file_type }) => !file_type.startsWith("image/"));
2255
- const imageAttachments = attachmentsOfComponent.filter(({ file_type }) => file_type.startsWith("image/"));
2266
+ const fileAttachments = attachmentsOfComponent.filter(
2267
+ // this null check here is necessary, there are cases where file_type is null or undefined
2268
+ ({ file_type }) => !file_type || !file_type.startsWith("image/")
2269
+ );
2270
+ const imageAttachments = attachmentsOfComponent.filter(
2271
+ // this null check here is necessary, there are cases where file_type is null or undefined
2272
+ ({ file_type }) => file_type && file_type.startsWith("image/")
2273
+ );
2256
2274
  return { fileAttachments, imageAttachments };
2257
2275
  }
2258
2276
  )
@@ -4101,6 +4119,10 @@ class AttachmentService extends BaseApiService {
4101
4119
  ...fileProps
4102
4120
  }
4103
4121
  });
4122
+ promise.catch((error2) => {
4123
+ this.client.store.dispatch(removeIssueAttachment(offlineAttachment.offline_id));
4124
+ throw error2;
4125
+ });
4104
4126
  return [offlineAttachment, promise];
4105
4127
  }
4106
4128
  async addComponentAttachment(attachmentPayload) {
@@ -4131,6 +4153,10 @@ class AttachmentService extends BaseApiService {
4131
4153
  ...fileProps
4132
4154
  }
4133
4155
  });
4156
+ promise.catch((error2) => {
4157
+ this.client.store.dispatch(removeComponentAttachment(offlineAttachment.offline_id));
4158
+ throw error2;
4159
+ });
4134
4160
  return [offlineAttachment, promise];
4135
4161
  }
4136
4162
  async addComponentTypeAttachment(attachmentPayload) {
@@ -4150,7 +4176,7 @@ class AttachmentService extends BaseApiService {
4150
4176
  const promise = this.enqueueRequest({
4151
4177
  description: "Create attachment",
4152
4178
  method: HttpMethod.POST,
4153
- url: `/component_types/${component_type_id}/attach/`,
4179
+ url: `/types/${component_type_id}/attach/`,
4154
4180
  blocks: [offline_id, component_type_id],
4155
4181
  blockers: [file_sha1],
4156
4182
  payload: {
@@ -4161,6 +4187,10 @@ class AttachmentService extends BaseApiService {
4161
4187
  ...fileProps
4162
4188
  }
4163
4189
  });
4190
+ promise.catch((error2) => {
4191
+ this.client.store.dispatch(removeComponentTypeAttachment(offlineAttachment.offline_id));
4192
+ throw error2;
4193
+ });
4164
4194
  return [offlineAttachment, promise];
4165
4195
  }
4166
4196
  /** the outer Promise is needed to await the hashing of each file, which is required before offline use. If wanting to
@@ -12530,7 +12560,7 @@ const ImageCard = memo((props) => {
12530
12560
  gap: "0",
12531
12561
  ...rest,
12532
12562
  children: [
12533
- !file && /* @__PURE__ */ jsx(Flex, { width: "100%", height: "100%", align: "center", justify: "center", position: "absolute", children: /* @__PURE__ */ jsx(Spinner, {}) }),
12563
+ !file && !error2 && /* @__PURE__ */ jsx(Flex, { width: "100%", height: "100%", align: "center", justify: "center", position: "absolute", children: /* @__PURE__ */ jsx(Spinner, {}) }),
12534
12564
  /* @__PURE__ */ jsx(Inset, { className: styles$4.ImageInset, ref: imageInsetRef, clip: "padding-box", side: "y", pb: "0", children: file && !error2 && /* @__PURE__ */ jsx("img", { className: styles$4.Image, src: URL.createObjectURL(file), alt: alt ?? file.name }) }),
12535
12565
  /* @__PURE__ */ jsx(
12536
12566
  OvermapItem,