@overmap-ai/core 1.0.53-fix-outbox.0 → 1.0.53-fix-outbox.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
|
@@ -46,7 +46,7 @@ class OutboxCoordinator {
|
|
|
46
46
|
/**
|
|
47
47
|
* Used when the app is loaded. Reconstructs the dependency graph based on an outbox from the redux-offline store.
|
|
48
48
|
*/
|
|
49
|
-
static
|
|
49
|
+
static _fromOutbox(outbox) {
|
|
50
50
|
const ret = new OutboxCoordinator();
|
|
51
51
|
for (let i = 0; i < outbox.length; i++) {
|
|
52
52
|
const outboxItem = outbox[i];
|
|
@@ -4641,9 +4641,17 @@ const rootReducer = (state, action) => {
|
|
|
4641
4641
|
return overmapReducer(mutatedState, action);
|
|
4642
4642
|
};
|
|
4643
4643
|
let __OUTBOX_COORDINATOR = null;
|
|
4644
|
-
function
|
|
4644
|
+
function getOutboxCoordinator() {
|
|
4645
4645
|
if (!__OUTBOX_COORDINATOR) {
|
|
4646
|
-
|
|
4646
|
+
const clientStore2 = getClientStore();
|
|
4647
|
+
if (!clientStore2) {
|
|
4648
|
+
console.error(
|
|
4649
|
+
"Cannot reload outbox because there is no client store yet. If there is an outbox, it will be broken."
|
|
4650
|
+
);
|
|
4651
|
+
return new OutboxCoordinator();
|
|
4652
|
+
}
|
|
4653
|
+
const outbox = clientStore2.getState().offline.outbox;
|
|
4654
|
+
__OUTBOX_COORDINATOR = OutboxCoordinator._fromOutbox(outbox);
|
|
4647
4655
|
}
|
|
4648
4656
|
return __OUTBOX_COORDINATOR;
|
|
4649
4657
|
}
|
|
@@ -4658,12 +4666,12 @@ const persistCallback = (err) => {
|
|
|
4658
4666
|
}
|
|
4659
4667
|
};
|
|
4660
4668
|
const enqueue = (_array, item, _context) => {
|
|
4661
|
-
const coordinator =
|
|
4669
|
+
const coordinator = getOutboxCoordinator();
|
|
4662
4670
|
coordinator.addRequest(item);
|
|
4663
4671
|
return coordinator.getQueue();
|
|
4664
4672
|
};
|
|
4665
4673
|
const dequeue = (_array, item, _context) => {
|
|
4666
|
-
const coordinator =
|
|
4674
|
+
const coordinator = getOutboxCoordinator();
|
|
4667
4675
|
const meta = item.meta;
|
|
4668
4676
|
const uuid = meta.offlineAction.payload.uuid;
|
|
4669
4677
|
coordinator.remove(uuid);
|
|
@@ -4955,7 +4963,7 @@ function discard(reason, action, retries = 0) {
|
|
|
4955
4963
|
const uuid = action.payload.uuid;
|
|
4956
4964
|
function rollbackAndThrow() {
|
|
4957
4965
|
clientStore2.dispatch(markAsDeleted(uuid));
|
|
4958
|
-
|
|
4966
|
+
getOutboxCoordinator().remove(action.payload.uuid);
|
|
4959
4967
|
const rollbackAction = action.meta.offline.rollback;
|
|
4960
4968
|
if (rollbackAction) {
|
|
4961
4969
|
console.warn("Rolling back request due to SDK error:", action);
|
|
@@ -4986,17 +4994,17 @@ function discard(reason, action, retries = 0) {
|
|
|
4986
4994
|
console.error(`Could not display toast for status ${status} because there is no toast handle.`);
|
|
4987
4995
|
}
|
|
4988
4996
|
}
|
|
4989
|
-
|
|
4997
|
+
getOutboxCoordinator().remove(action.payload.uuid);
|
|
4990
4998
|
reason.options.discard = true;
|
|
4991
4999
|
rollbackAndThrow();
|
|
4992
5000
|
}
|
|
4993
5001
|
}
|
|
4994
5002
|
console.debug("Registering a retry for request:", action.payload.uuid);
|
|
4995
|
-
|
|
5003
|
+
getOutboxCoordinator().registerRetry(action.payload.uuid);
|
|
4996
5004
|
return false;
|
|
4997
5005
|
}
|
|
4998
5006
|
function peek(_array, _item, _context) {
|
|
4999
|
-
const ret =
|
|
5007
|
+
const ret = getOutboxCoordinator().peek();
|
|
5000
5008
|
if (!ret) {
|
|
5001
5009
|
throw new Error(`Peek returned ${ret}`);
|
|
5002
5010
|
}
|
|
@@ -16927,6 +16935,7 @@ export {
|
|
|
16927
16935
|
getLocalDateString,
|
|
16928
16936
|
getLocalRelativeDateString,
|
|
16929
16937
|
getMarkerCoordinates,
|
|
16938
|
+
getOutboxCoordinator,
|
|
16930
16939
|
getRenamedFile,
|
|
16931
16940
|
getStageColor,
|
|
16932
16941
|
hashFile,
|