@overmap-ai/core 1.0.46-project-attachments.3 → 1.0.46-project-attachments.5

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.
@@ -3687,9 +3687,7 @@ const documentSlice = createSlice({
3687
3687
  if (action.payload.filter(onlyUniqueOfflineIds).length !== action.payload.length) {
3688
3688
  throw new Error("Tried to use setIssues reducer with duplicate ID's");
3689
3689
  }
3690
- for (const document2 of action.payload) {
3691
- state.documents[document2.offline_id] = document2;
3692
- }
3690
+ state.documents = toOfflineIdRecord(action.payload);
3693
3691
  },
3694
3692
  addDocuments: (state, action) => {
3695
3693
  for (const document2 of action.payload) {
@@ -7299,6 +7297,9 @@ class DocumentService extends BaseApiService {
7299
7297
  method: HttpMethod.POST,
7300
7298
  url: `/projects/${activeProjectId}/create-document/`,
7301
7299
  payload: { ...offlineDocument },
7300
+ queryParams: {
7301
+ parent_document: offlineDocument.parent_document ?? void 0
7302
+ },
7302
7303
  // if adding as a child of another document, need that document to exist first
7303
7304
  blockers: offlineDocument.parent_document ? [offlineDocument.parent_document] : [],
7304
7305
  blocks: [offlineDocument.offline_id]
@@ -7326,7 +7327,7 @@ class DocumentService extends BaseApiService {
7326
7327
  blocks: [document2.offline_id]
7327
7328
  });
7328
7329
  promise.catch(() => {
7329
- setDocuments([documentToBeUpdated]);
7330
+ updateDocuments([documentToBeUpdated]);
7330
7331
  });
7331
7332
  const fullDocument = store.getState().documentsReducer.documents[document2.offline_id];
7332
7333
  return [fullDocument, promise];
@@ -7370,9 +7371,9 @@ class DocumentService extends BaseApiService {
7370
7371
  blocks: []
7371
7372
  });
7372
7373
  promise.then((result) => {
7373
- setDocuments(result);
7374
+ updateDocuments(result);
7374
7375
  }).catch(() => {
7375
- setDocuments(documentsToRevertIfMoveFails);
7376
+ updateDocuments(documentsToRevertIfMoveFails);
7376
7377
  });
7377
7378
  return promise;
7378
7379
  }
@@ -7397,9 +7398,9 @@ class DocumentService extends BaseApiService {
7397
7398
  promise.then((documentsToUpdate) => {
7398
7399
  store.dispatch(updateDocuments(documentsToUpdate));
7399
7400
  }).catch(() => {
7400
- store.dispatch(setDocuments([documentToBeDeleted]));
7401
+ store.dispatch(updateDocuments([documentToBeDeleted]));
7401
7402
  if (parentDocument) {
7402
- store.dispatch(setDocuments([parentDocument]));
7403
+ store.dispatch(updateDocuments([parentDocument]));
7403
7404
  }
7404
7405
  });
7405
7406
  return promise;