@atlaskit/editor-synced-block-provider 10.0.3 → 10.0.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.
- package/CHANGELOG.md +17 -0
- package/dist/cjs/common/types.js +2 -3
- package/dist/cjs/hooks/useFetchSyncBlockData.js +4 -4
- package/dist/cjs/store-manager/referenceSyncBlockStoreManager.js +27 -56
- package/dist/cjs/store-manager/sourceSyncBlockStoreManager.js +22 -41
- package/dist/cjs/store-manager/syncBlockBatchFetcher.js +6 -12
- package/dist/cjs/store-manager/syncBlockProviderFactoryManager.js +3 -3
- package/dist/cjs/store-manager/syncBlockStoreManager.js +1 -5
- package/dist/cjs/store-manager/syncBlockSubscriptionManager.js +20 -85
- package/dist/cjs/utils/errorHandling.js +13 -32
- package/dist/es2019/common/types.js +2 -3
- package/dist/es2019/hooks/useFetchSyncBlockData.js +4 -5
- package/dist/es2019/store-manager/referenceSyncBlockStoreManager.js +26 -50
- package/dist/es2019/store-manager/sourceSyncBlockStoreManager.js +23 -42
- package/dist/es2019/store-manager/syncBlockBatchFetcher.js +6 -12
- package/dist/es2019/store-manager/syncBlockProviderFactoryManager.js +3 -3
- package/dist/es2019/store-manager/syncBlockStoreManager.js +1 -5
- package/dist/es2019/store-manager/syncBlockSubscriptionManager.js +25 -81
- package/dist/es2019/utils/errorHandling.js +13 -32
- package/dist/esm/common/types.js +2 -3
- package/dist/esm/hooks/useFetchSyncBlockData.js +4 -4
- package/dist/esm/store-manager/referenceSyncBlockStoreManager.js +27 -56
- package/dist/esm/store-manager/sourceSyncBlockStoreManager.js +22 -41
- package/dist/esm/store-manager/syncBlockBatchFetcher.js +6 -12
- package/dist/esm/store-manager/syncBlockProviderFactoryManager.js +3 -3
- package/dist/esm/store-manager/syncBlockStoreManager.js +1 -5
- package/dist/esm/store-manager/syncBlockSubscriptionManager.js +20 -85
- package/dist/esm/utils/errorHandling.js +13 -32
- package/dist/types/common/types.d.ts +2 -3
- package/dist/types/store-manager/referenceSyncBlockStoreManager.d.ts +3 -3
- package/dist/types/store-manager/sourceSyncBlockStoreManager.d.ts +5 -7
- package/dist/types/store-manager/syncBlockSubscriptionManager.d.ts +2 -5
- package/dist/types/utils/errorHandling.d.ts +11 -24
- package/package.json +3 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/editor-synced-block-provider
|
|
2
2
|
|
|
3
|
+
## 10.0.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`1f0dab65b6efd`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/1f0dab65b6efd) -
|
|
8
|
+
Remove unreachable cut-handling branch and duplicated synced block node view setup left over from
|
|
9
|
+
feature gate cleanup
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 10.0.4
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [`0b4753c0a8c07`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0b4753c0a8c07) -
|
|
17
|
+
Clean up feature gates from completed rollout
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
|
|
3
20
|
## 10.0.3
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/dist/cjs/common/types.js
CHANGED
|
@@ -54,14 +54,13 @@ var SyncBlockError = exports.SyncBlockError = /*#__PURE__*/function (SyncBlockEr
|
|
|
54
54
|
* asynchronously and `destroy()` nulls it on orphaned managers, so queued/
|
|
55
55
|
* in-flight ops throw `Data provider not set` — previously mis-logged as a real
|
|
56
56
|
* error. These let throw and catch sites agree on one non-string-matched signal
|
|
57
|
-
* so the residual false errors are suppressed.
|
|
58
|
-
* `platform_editor_blocks_patch_3`.
|
|
57
|
+
* so the residual false errors are suppressed.
|
|
59
58
|
*
|
|
60
59
|
* NB: these intentionally live here rather than in a dedicated module to avoid
|
|
61
60
|
* adding a downstream file to consuming Jira packages' Thunderstone complexity.
|
|
62
61
|
*/
|
|
63
62
|
|
|
64
|
-
/** Legacy message — kept identical for
|
|
63
|
+
/** Legacy message — kept identical for historical events. */
|
|
65
64
|
var PROVIDER_NOT_READY_MESSAGE = exports.PROVIDER_NOT_READY_MESSAGE = 'Data provider not set';
|
|
66
65
|
|
|
67
66
|
/**
|
|
@@ -47,10 +47,10 @@ var useFetchSyncBlockData = exports.useFetchSyncBlockData = function useFetchSyn
|
|
|
47
47
|
// On Jira the data provider is wired asynchronously, so the manager can be
|
|
48
48
|
// constructed with `dataProvider === undefined`. Fetching/subscribing in that
|
|
49
49
|
// window throws `Data provider not set`, logged as a false fetch error
|
|
50
|
-
// (EDITOR-7860).
|
|
50
|
+
// (EDITOR-7860). Check readiness; once the provider resolves a new manager
|
|
51
51
|
// instance is created so `referenceManager` changes identity and the effect
|
|
52
52
|
// below re-runs, subscribing exactly once.
|
|
53
|
-
var isDataProviderReady = (
|
|
53
|
+
var isDataProviderReady = (_manager$referenceMan2 = (_manager$referenceMan3 = (_manager$referenceMan4 = manager.referenceManager).hasDataProvider) === null || _manager$referenceMan3 === void 0 ? void 0 : _manager$referenceMan3.call(_manager$referenceMan4)) !== null && _manager$referenceMan2 !== void 0 ? _manager$referenceMan2 : false;
|
|
54
54
|
var reloadData = (0, _react.useCallback)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
55
55
|
var syncBlockNode, _t;
|
|
56
56
|
return _regenerator.default.wrap(function (_context) {
|
|
@@ -91,7 +91,7 @@ var useFetchSyncBlockData = exports.useFetchSyncBlockData = function useFetchSyn
|
|
|
91
91
|
case 5:
|
|
92
92
|
_context.prev = 5;
|
|
93
93
|
_t = _context["catch"](2);
|
|
94
|
-
if (!(
|
|
94
|
+
if (!(0, _types.isProviderNotReadyError)(_t)) {
|
|
95
95
|
_context.next = 6;
|
|
96
96
|
break;
|
|
97
97
|
}
|
|
@@ -105,7 +105,7 @@ var useFetchSyncBlockData = exports.useFetchSyncBlockData = function useFetchSyn
|
|
|
105
105
|
(0, _monitoring.logException)(_t, {
|
|
106
106
|
location: 'editor-synced-block-provider/useFetchSyncBlockData'
|
|
107
107
|
});
|
|
108
|
-
fireAnalyticsEvent === null || fireAnalyticsEvent === void 0 || fireAnalyticsEvent((0, _errorHandling.fetchErrorPayload)(_t.message, resourceId, (0, _utils.getSourceProductFromResourceIdSafe)(resourceId), (0, _errorHandling.buildFetchErrorAttribution)(
|
|
108
|
+
fireAnalyticsEvent === null || fireAnalyticsEvent === void 0 || fireAnalyticsEvent((0, _errorHandling.fetchErrorPayload)(_t.message, resourceId, (0, _utils.getSourceProductFromResourceIdSafe)(resourceId), (0, _errorHandling.buildFetchErrorAttribution)(_t.message)));
|
|
109
109
|
|
|
110
110
|
// Thread the PII-safe original message/name so the renderer can de-opaque
|
|
111
111
|
// this otherwise-bare `errored` failure. `originalMessage` carries the
|
|
@@ -13,7 +13,6 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
|
|
|
13
13
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
14
14
|
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
|
15
15
|
var _monitoring = require("@atlaskit/editor-common/monitoring");
|
|
16
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
17
16
|
var _types = require("../common/types");
|
|
18
17
|
var _errorHandling = require("../utils/errorHandling");
|
|
19
18
|
var _experienceTracking = require("../utils/experienceTracking");
|
|
@@ -33,7 +32,7 @@ var ENTITY_NOT_FOUND_MAX_RETRIES = 3;
|
|
|
33
32
|
var ENTITY_NOT_FOUND_INITIAL_DELAY_MS = 2000;
|
|
34
33
|
|
|
35
34
|
// Grace period before a cache entry is removed after the last subscriber
|
|
36
|
-
// unsubscribes
|
|
35
|
+
// unsubscribes. Guards are
|
|
37
36
|
// re-checked at fire time; if any are positive, the timer is rescheduled.
|
|
38
37
|
var CACHE_DELETION_GRACE_PERIOD_MS = 30000;
|
|
39
38
|
// Max reschedules before force-deleting with an analytics event (~5 min).
|
|
@@ -62,8 +61,7 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
62
61
|
// Track retry attempts for EntityNotFound errors (block may be in the process of being created)
|
|
63
62
|
(0, _defineProperty2.default)(this, "entityNotFoundRetryCount", new Map());
|
|
64
63
|
(0, _defineProperty2.default)(this, "entityNotFoundRetryTimers", new Map());
|
|
65
|
-
// Pending cache deletion timers keyed by resourceId
|
|
66
|
-
// `platform_synced_block_patch_14`). Cancelled when a subscriber re-attaches.
|
|
64
|
+
// Pending cache deletion timers keyed by resourceId. Cancelled when a subscriber re-attaches.
|
|
67
65
|
(0, _defineProperty2.default)(this, "pendingCacheDeletions", new Map());
|
|
68
66
|
// Reschedule counter per resource — reset on actual deletion or re-subscribe.
|
|
69
67
|
(0, _defineProperty2.default)(this, "cacheDeletionRescheduleCounts", new Map());
|
|
@@ -84,9 +82,6 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
84
82
|
updateCache: function updateCache(inst) {
|
|
85
83
|
return _this.updateCache(inst);
|
|
86
84
|
},
|
|
87
|
-
deleteFromCache: function deleteFromCache(rid) {
|
|
88
|
-
return _this.deleteFromCache(rid);
|
|
89
|
-
},
|
|
90
85
|
debouncedBatchedFetchSyncBlocks: function debouncedBatchedFetchSyncBlocks(rid) {
|
|
91
86
|
return _this.debouncedBatchedFetchSyncBlocks(rid);
|
|
92
87
|
},
|
|
@@ -100,7 +95,7 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
100
95
|
_this.isCacheDirty = true;
|
|
101
96
|
},
|
|
102
97
|
// Delegate cache lifecycle to the store manager so guards can be
|
|
103
|
-
// checked atomically
|
|
98
|
+
// checked atomically.
|
|
104
99
|
scheduleCacheDeletion: function scheduleCacheDeletion(rid) {
|
|
105
100
|
return _this.scheduleCacheDeletion(rid);
|
|
106
101
|
},
|
|
@@ -548,28 +543,22 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
548
543
|
return _context2.abrupt("return");
|
|
549
544
|
case 2:
|
|
550
545
|
if (this.dataProvider) {
|
|
551
|
-
_context2.next = 4;
|
|
552
|
-
break;
|
|
553
|
-
}
|
|
554
|
-
if (!(0, _platformFeatureFlags.fg)('platform_editor_blocks_patch_3')) {
|
|
555
546
|
_context2.next = 3;
|
|
556
547
|
break;
|
|
557
548
|
}
|
|
558
549
|
throw new _types.ProviderNotReadyError();
|
|
559
550
|
case 3:
|
|
560
|
-
throw new Error('Data provider not set');
|
|
561
|
-
case 4:
|
|
562
551
|
nodesToFetch.forEach(function (node) {
|
|
563
552
|
_this4.syncBlockFetchDataRequests.set(node.attrs.resourceId, true);
|
|
564
553
|
});
|
|
565
554
|
(_this$fetchExperience6 = this.fetchExperience) === null || _this$fetchExperience6 === void 0 || _this$fetchExperience6.start({});
|
|
566
|
-
_context2.next =
|
|
555
|
+
_context2.next = 4;
|
|
567
556
|
return this.dataProvider.fetchNodesData(nodesToFetch).finally(function () {
|
|
568
557
|
nodesToFetch.forEach(function (node) {
|
|
569
558
|
_this4.syncBlockFetchDataRequests.delete(node.attrs.resourceId);
|
|
570
559
|
});
|
|
571
560
|
});
|
|
572
|
-
case
|
|
561
|
+
case 4:
|
|
573
562
|
data = _context2.sent;
|
|
574
563
|
_this$processFetchedD2 = this.processFetchedData(data), hasUnexpectedError = _this$processFetchedD2.hasUnexpectedError, hasExpectedError = _this$processFetchedD2.hasExpectedError;
|
|
575
564
|
if (hasUnexpectedError) {
|
|
@@ -583,7 +572,7 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
583
572
|
} else {
|
|
584
573
|
(_this$fetchExperience9 = this.fetchExperience) === null || _this$fetchExperience9 === void 0 || _this$fetchExperience9.success();
|
|
585
574
|
}
|
|
586
|
-
case
|
|
575
|
+
case 5:
|
|
587
576
|
case "end":
|
|
588
577
|
return _context2.stop();
|
|
589
578
|
}
|
|
@@ -614,7 +603,7 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
614
603
|
// No resourceId means we cannot derive a sourceProduct here; intentionally omit.
|
|
615
604
|
// Classify on the structured `type` first, falling back to the free-text
|
|
616
605
|
// `reason`/payload (EDITOR-7862).
|
|
617
|
-
(_this5$fireAnalyticsE = _this5.fireAnalyticsEvent) === null || _this5$fireAnalyticsE === void 0 || _this5$fireAnalyticsE.call(_this5, (0, _errorHandling.fetchErrorPayload)(payload, undefined, undefined, (0, _errorHandling.buildFetchErrorAttribution)((
|
|
606
|
+
(_this5$fireAnalyticsE = _this5.fireAnalyticsEvent) === null || _this5$fireAnalyticsE === void 0 || _this5$fireAnalyticsE.call(_this5, (0, _errorHandling.fetchErrorPayload)(payload, undefined, undefined, (0, _errorHandling.buildFetchErrorAttribution)(((_syncBlockInstance$er3 = syncBlockInstance.error) === null || _syncBlockInstance$er3 === void 0 ? void 0 : _syncBlockInstance$er3.type) || ((_syncBlockInstance$er4 = syncBlockInstance.error) === null || _syncBlockInstance$er4 === void 0 ? void 0 : _syncBlockInstance$er4.reason) || payload, (_syncBlockInstance$er5 = syncBlockInstance.error) === null || _syncBlockInstance$er5 === void 0 ? void 0 : _syncBlockInstance$er5.statusCode)));
|
|
618
607
|
return;
|
|
619
608
|
}
|
|
620
609
|
var existingSyncBlock = _this5.getFromCache(syncBlockInstance.resourceId);
|
|
@@ -645,13 +634,13 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
645
634
|
var _this5$entityNotFound;
|
|
646
635
|
// Skip error analytics when EntityNotFound will be retried, to avoid
|
|
647
636
|
// inflating error-rate metrics with expected transient failures
|
|
648
|
-
var isRetryingEntityNotFound = syncBlockInstance.error.type === _types.SyncBlockError.EntityNotFound && ((_this5$entityNotFound = _this5.entityNotFoundRetryCount.get(syncBlockInstance.resourceId)) !== null && _this5$entityNotFound !== void 0 ? _this5$entityNotFound : 0) < ENTITY_NOT_FOUND_MAX_RETRIES
|
|
637
|
+
var isRetryingEntityNotFound = syncBlockInstance.error.type === _types.SyncBlockError.EntityNotFound && ((_this5$entityNotFound = _this5.entityNotFoundRetryCount.get(syncBlockInstance.resourceId)) !== null && _this5$entityNotFound !== void 0 ? _this5$entityNotFound : 0) < ENTITY_NOT_FOUND_MAX_RETRIES;
|
|
649
638
|
if (!isRetryingEntityNotFound) {
|
|
650
639
|
var _this5$fireAnalyticsE2, _syncBlockInstance$da, _syncBlockInstance$da2;
|
|
651
640
|
// Classify on the structured `type` (a `SyncBlockError` enum value) first,
|
|
652
641
|
// falling back to the free-text `reason` so source-state/permission strings
|
|
653
642
|
// are still bucketed (EDITOR-7862). The emitted `error` attribute is unchanged.
|
|
654
|
-
(_this5$fireAnalyticsE2 = _this5.fireAnalyticsEvent) === null || _this5$fireAnalyticsE2 === void 0 || _this5$fireAnalyticsE2.call(_this5, (0, _errorHandling.fetchErrorPayload)(syncBlockInstance.error.reason || syncBlockInstance.error.type, syncBlockInstance.resourceId, (_syncBlockInstance$da = (_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.product) !== null && _syncBlockInstance$da !== void 0 ? _syncBlockInstance$da : (0, _utils.getSourceProductFromResourceIdSafe)(syncBlockInstance.resourceId), (0, _errorHandling.buildFetchErrorAttribution)(
|
|
643
|
+
(_this5$fireAnalyticsE2 = _this5.fireAnalyticsEvent) === null || _this5$fireAnalyticsE2 === void 0 || _this5$fireAnalyticsE2.call(_this5, (0, _errorHandling.fetchErrorPayload)(syncBlockInstance.error.reason || syncBlockInstance.error.type, syncBlockInstance.resourceId, (_syncBlockInstance$da = (_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.product) !== null && _syncBlockInstance$da !== void 0 ? _syncBlockInstance$da : (0, _utils.getSourceProductFromResourceIdSafe)(syncBlockInstance.resourceId), (0, _errorHandling.buildFetchErrorAttribution)(syncBlockInstance.error.type || syncBlockInstance.error.reason, syncBlockInstance.error.statusCode)));
|
|
655
644
|
}
|
|
656
645
|
if (syncBlockInstance.error.type === _types.SyncBlockError.NotFound || syncBlockInstance.error.type === _types.SyncBlockError.Forbidden) {
|
|
657
646
|
hasExpectedError = true;
|
|
@@ -659,9 +648,7 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
659
648
|
// Schedule a retry for EntityNotFound — the source block may be in
|
|
660
649
|
// the process of being created by a collaborator (race condition
|
|
661
650
|
// between NCS propagation and Block Service createBlock call).
|
|
662
|
-
|
|
663
|
-
_this5.scheduleEntityNotFoundRetry(syncBlockInstance.resourceId);
|
|
664
|
-
}
|
|
651
|
+
_this5.scheduleEntityNotFoundRetry(syncBlockInstance.resourceId);
|
|
665
652
|
if (!isRetryingEntityNotFound) {
|
|
666
653
|
hasUnexpectedError = true;
|
|
667
654
|
}
|
|
@@ -689,7 +676,7 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
689
676
|
var existingSyncBlock = this.getFromCache(resourceId);
|
|
690
677
|
// If the cache entry was deleted while the source-info request was
|
|
691
678
|
// in flight, fire an analytics event so the race is observable.
|
|
692
|
-
if (!existingSyncBlock
|
|
679
|
+
if (!existingSyncBlock) {
|
|
693
680
|
var _this$fireAnalyticsEv5;
|
|
694
681
|
(_this$fireAnalyticsEv5 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv5 === void 0 || _this$fireAnalyticsEv5.call(this, (0, _errorHandling.sourceInfoOrphanedPayload)(resourceId, (0, _utils.getSourceProductFromResourceIdSafe)(resourceId), {
|
|
695
682
|
hasPendingDeletion: this.pendingCacheDeletions.has(resourceId),
|
|
@@ -742,16 +729,14 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
742
729
|
this._providerFactoryManager.deleteFactory(resourceId);
|
|
743
730
|
// Evict in-flight source-info promise and reset reschedule counter
|
|
744
731
|
// so a stale resolution can't silently merge into a re-fetched entry.
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
this.cacheDeletionRescheduleCounts.delete(resourceId);
|
|
748
|
-
}
|
|
732
|
+
this.syncBlockSourceInfoRequests.delete(resourceId);
|
|
733
|
+
this.cacheDeletionRescheduleCounts.delete(resourceId);
|
|
749
734
|
}
|
|
750
735
|
|
|
751
736
|
/**
|
|
752
737
|
* Returns true if the cache entry for `resourceId` is safe to delete:
|
|
753
738
|
* no active subscribers, no in-flight source-info request, and no
|
|
754
|
-
* queued/in-flight batch fetch
|
|
739
|
+
* queued/in-flight batch fetch.
|
|
755
740
|
*/
|
|
756
741
|
}, {
|
|
757
742
|
key: "canDeleteCache",
|
|
@@ -770,7 +755,7 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
770
755
|
|
|
771
756
|
/**
|
|
772
757
|
* Schedules cache deletion for `resourceId` after the grace period
|
|
773
|
-
*
|
|
758
|
+
* Called when the last
|
|
774
759
|
* subscriber unsubscribes. Guards are re-checked at fire time; if any
|
|
775
760
|
* are positive the timer is rescheduled up to MAX_RESCHEDULES times.
|
|
776
761
|
*/
|
|
@@ -778,9 +763,6 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
778
763
|
key: "scheduleCacheDeletion",
|
|
779
764
|
value: function scheduleCacheDeletion(resourceId) {
|
|
780
765
|
var _this6 = this;
|
|
781
|
-
if (!(0, _platformFeatureFlags.fg)('platform_synced_block_patch_14')) {
|
|
782
|
-
return;
|
|
783
|
-
}
|
|
784
766
|
if (this.isDestroyed) {
|
|
785
767
|
return;
|
|
786
768
|
}
|
|
@@ -808,15 +790,12 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
808
790
|
|
|
809
791
|
/**
|
|
810
792
|
* Cancels any pending cache deletion timer for `resourceId` and resets the
|
|
811
|
-
* reschedule counter
|
|
793
|
+
* reschedule counter. Called
|
|
812
794
|
* when a new subscriber arrives.
|
|
813
795
|
*/
|
|
814
796
|
}, {
|
|
815
797
|
key: "cancelPendingCacheDeletion",
|
|
816
798
|
value: function cancelPendingCacheDeletion(resourceId) {
|
|
817
|
-
if (!(0, _platformFeatureFlags.fg)('platform_synced_block_patch_14')) {
|
|
818
|
-
return;
|
|
819
|
-
}
|
|
820
799
|
var existing = this.pendingCacheDeletions.get(resourceId);
|
|
821
800
|
if (existing) {
|
|
822
801
|
clearTimeout(existing);
|
|
@@ -838,7 +817,7 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
838
817
|
value: function onCacheDeletionTimerFire(resourceId) {
|
|
839
818
|
var _this$cacheDeletionRe;
|
|
840
819
|
if (this.canDeleteCache(resourceId)) {
|
|
841
|
-
// `deleteFromCache` resets the reschedule counter
|
|
820
|
+
// `deleteFromCache` resets the reschedule counter.
|
|
842
821
|
this.deleteFromCache(resourceId);
|
|
843
822
|
return;
|
|
844
823
|
}
|
|
@@ -858,7 +837,7 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
858
837
|
(0, _monitoring.logException)(new Error("Cache deletion forced after ".concat(currentCount, " reschedules \u2014 stuck in-flight guard")), {
|
|
859
838
|
location: 'editor-synced-block-provider/referenceSyncBlockStoreManager/cache-deletion-forced'
|
|
860
839
|
});
|
|
861
|
-
// `deleteFromCache` resets the reschedule counter
|
|
840
|
+
// `deleteFromCache` resets the reschedule counter.
|
|
862
841
|
this.deleteFromCache(resourceId);
|
|
863
842
|
// If subscribers still exist, kick off a fresh fetch so they get
|
|
864
843
|
// fresh data on the next batch tick instead of holding stale data
|
|
@@ -968,14 +947,14 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
968
947
|
var _this$fireAnalyticsEv7;
|
|
969
948
|
// EDITOR-7860: benign not-ready/torn-down case — suppress both the
|
|
970
949
|
// exception-tracker log and the analytics event (checked first so the
|
|
971
|
-
// benign case stays fully silent).
|
|
972
|
-
if ((0, _types.isProviderNotReadyError)(error)
|
|
950
|
+
// benign case stays fully silent).
|
|
951
|
+
if ((0, _types.isProviderNotReadyError)(error)) {
|
|
973
952
|
return function () {};
|
|
974
953
|
}
|
|
975
954
|
(0, _monitoring.logException)(error, {
|
|
976
955
|
location: 'editor-synced-block-provider/referenceSyncBlockStoreManager'
|
|
977
956
|
});
|
|
978
|
-
(_this$fireAnalyticsEv7 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv7 === void 0 || _this$fireAnalyticsEv7.call(this, (0, _errorHandling.fetchErrorPayload)(error.message, undefined, undefined, (0, _errorHandling.buildFetchErrorAttribution)(
|
|
957
|
+
(_this$fireAnalyticsEv7 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv7 === void 0 || _this$fireAnalyticsEv7.call(this, (0, _errorHandling.fetchErrorPayload)(error.message, undefined, undefined, (0, _errorHandling.buildFetchErrorAttribution)(error.message)));
|
|
979
958
|
return function () {};
|
|
980
959
|
}
|
|
981
960
|
}
|
|
@@ -1138,7 +1117,7 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
1138
1117
|
(_this$saveExperience2 = this.saveExperience) === null || _this$saveExperience2 === void 0 || _this$saveExperience2.failure({
|
|
1139
1118
|
reason: updateResult.error || 'Failed to update reference synced blocks on the document'
|
|
1140
1119
|
});
|
|
1141
|
-
(_this$fireAnalyticsEv8 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv8 === void 0 || _this$fireAnalyticsEv8.call(this, (0, _errorHandling.updateReferenceErrorPayload)(updateResult.error || 'Failed to update reference synced blocks on the document', undefined, undefined, (0, _errorHandling.buildErrorAttribution)(
|
|
1120
|
+
(_this$fireAnalyticsEv8 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv8 === void 0 || _this$fireAnalyticsEv8.call(this, (0, _errorHandling.updateReferenceErrorPayload)(updateResult.error || 'Failed to update reference synced blocks on the document', undefined, undefined, (0, _errorHandling.buildErrorAttribution)(updateResult.error, updateResult.statusCode)));
|
|
1142
1121
|
}
|
|
1143
1122
|
_context4.next = 17;
|
|
1144
1123
|
break;
|
|
@@ -1154,8 +1133,8 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
1154
1133
|
});
|
|
1155
1134
|
// No `resourceId` available in this catch — sourceProduct is intentionally omitted.
|
|
1156
1135
|
// No structured SyncBlockError/status here, so the attribution `reason` falls back
|
|
1157
|
-
// to `unknown
|
|
1158
|
-
(_this$fireAnalyticsEv9 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv9 === void 0 || _this$fireAnalyticsEv9.call(this, (0, _errorHandling.updateReferenceErrorPayload)(_t3.message, undefined, undefined, (0, _errorHandling.buildErrorAttribution)(
|
|
1136
|
+
// to `unknown`.
|
|
1137
|
+
(_this$fireAnalyticsEv9 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv9 === void 0 || _this$fireAnalyticsEv9.call(this, (0, _errorHandling.updateReferenceErrorPayload)(_t3.message, undefined, undefined, (0, _errorHandling.buildErrorAttribution)()));
|
|
1159
1138
|
case 17:
|
|
1160
1139
|
_context4.prev = 17;
|
|
1161
1140
|
if (!success) {
|
|
@@ -1237,17 +1216,9 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
1237
1216
|
});
|
|
1238
1217
|
this.fireAnalyticsEvent = undefined;
|
|
1239
1218
|
|
|
1240
|
-
//
|
|
1241
|
-
//
|
|
1242
|
-
//
|
|
1243
|
-
// cache data that a sibling/successor manager (e.g. the editor
|
|
1244
|
-
// instance that mounts immediately after the renderer unmounts during
|
|
1245
|
-
// the view-mode transition) is about to read.
|
|
1246
|
-
// Let entries age out naturally instead — the in-memory cache is
|
|
1247
|
-
// naturally bounded by `maxSize` (LRU) and cleared on hard navigation.
|
|
1248
|
-
if (!(0, _platformFeatureFlags.fg)('platform_synced_block_patch_14')) {
|
|
1249
|
-
_syncBlockInMemorySessionCache.syncBlockInMemorySessionCache.clear();
|
|
1250
|
-
}
|
|
1219
|
+
// `destroy()` is wired to React component unmount via
|
|
1220
|
+
// `useMemoizedSyncBlockStoreManager`. Let the in-memory session cache age
|
|
1221
|
+
// out naturally instead of clearing it during a view-mode transition.
|
|
1251
1222
|
}
|
|
1252
1223
|
}]);
|
|
1253
1224
|
}();
|
|
@@ -12,7 +12,6 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
|
|
|
12
12
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
13
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
14
14
|
var _monitoring = require("@atlaskit/editor-common/monitoring");
|
|
15
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
15
|
var _types = require("../common/types");
|
|
17
16
|
var _errorHandling = require("../utils/errorHandling");
|
|
18
17
|
var _experienceTracking = require("../utils/experienceTracking");
|
|
@@ -82,8 +81,7 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
|
|
|
82
81
|
(0, _defineProperty2.default)(this, "awaitingFirstContent", new Set());
|
|
83
82
|
/**
|
|
84
83
|
* resourceId -> timestamp (ms) of the last `syncedBlockDelete` emission, used
|
|
85
|
-
* to suppress duplicates within {@link DELETE_DEDUPE_WINDOW_MS}.
|
|
86
|
-
* behind `platform_editor_blocks_patch_4`.
|
|
84
|
+
* to suppress duplicates within {@link DELETE_DEDUPE_WINDOW_MS}.
|
|
87
85
|
*/
|
|
88
86
|
(0, _defineProperty2.default)(this, "recentDeleteEmissions", new Map());
|
|
89
87
|
(0, _defineProperty2.default)(this, "setPendingDeletion", function (Ids, value) {
|
|
@@ -169,10 +167,7 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
|
|
|
169
167
|
resourceId = _syncBlockNode$attrs.resourceId;
|
|
170
168
|
if (!localId || !resourceId) {
|
|
171
169
|
// Identifiers not populated yet: benign timing case, skip as a no-op.
|
|
172
|
-
|
|
173
|
-
return false;
|
|
174
|
-
}
|
|
175
|
-
throw new Error('Local ID or resource ID is not set');
|
|
170
|
+
return false;
|
|
176
171
|
}
|
|
177
172
|
var cachedBlock = this.syncBlockCache.get(resourceId);
|
|
178
173
|
|
|
@@ -215,7 +210,7 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
|
|
|
215
210
|
value: (function () {
|
|
216
211
|
var _flush = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
217
212
|
var _this2 = this;
|
|
218
|
-
var _this$saveExperience, timedOut, timeoutId, timeout, _iterator, _step, resourceId, bodiedSyncBlockNodes, bodiedSyncBlockData, writeResults, _this$saveExperience2, _this$saveExperience3,
|
|
213
|
+
var _this$saveExperience, timedOut, timeoutId, timeout, _iterator, _step, resourceId, bodiedSyncBlockNodes, bodiedSyncBlockData, writeResults, _this$saveExperience2, _this$saveExperience3, _this$fireAnalyticsEv2, _this$flushCompletion, _t;
|
|
219
214
|
return _regenerator.default.wrap(function (_context) {
|
|
220
215
|
while (1) switch (_context.prev = _context.next) {
|
|
221
216
|
case 0:
|
|
@@ -334,12 +329,11 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
|
|
|
334
329
|
return _context.abrupt("return", true);
|
|
335
330
|
case 7:
|
|
336
331
|
(_this$saveExperience3 = this.saveExperience) === null || _this$saveExperience3 === void 0 || _this$saveExperience3.failure();
|
|
337
|
-
attributionEnabled = (0, _platformFeatureFlags.fg)('platform_editor_blocks_patch_3');
|
|
338
332
|
writeResults.filter(function (result) {
|
|
339
333
|
return !result.resourceId || result.error;
|
|
340
334
|
}).forEach(function (result) {
|
|
341
335
|
var _this2$fireAnalyticsE2;
|
|
342
|
-
(_this2$fireAnalyticsE2 = _this2.fireAnalyticsEvent) === null || _this2$fireAnalyticsE2 === void 0 || _this2$fireAnalyticsE2.call(_this2, (0, _errorHandling.updateErrorPayload)(result.error || 'Failed to write data', result.resourceId, (0, _utils.getSourceProductFromResourceIdSafe)(result.resourceId), (0, _errorHandling.buildErrorAttribution)(
|
|
336
|
+
(_this2$fireAnalyticsE2 = _this2.fireAnalyticsEvent) === null || _this2$fireAnalyticsE2 === void 0 || _this2$fireAnalyticsE2.call(_this2, (0, _errorHandling.updateErrorPayload)(result.error || 'Failed to write data', result.resourceId, (0, _utils.getSourceProductFromResourceIdSafe)(result.resourceId), (0, _errorHandling.buildErrorAttribution)(result.error, result.statusCode)));
|
|
343
337
|
});
|
|
344
338
|
return _context.abrupt("return", false);
|
|
345
339
|
case 8:
|
|
@@ -353,7 +347,7 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
|
|
|
353
347
|
});
|
|
354
348
|
// Top-level flush failure is not tied to a single resourceId. There is no structured
|
|
355
349
|
// SyncBlockError/status here, so the attribution `reason` falls back to `unknown`.
|
|
356
|
-
(_this$fireAnalyticsEv2 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv2 === void 0 || _this$fireAnalyticsEv2.call(this, (0, _errorHandling.updateErrorPayload)(_t.message, undefined, undefined, (0, _errorHandling.buildErrorAttribution)(
|
|
350
|
+
(_this$fireAnalyticsEv2 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv2 === void 0 || _this$fireAnalyticsEv2.call(this, (0, _errorHandling.updateErrorPayload)(_t.message, undefined, undefined, (0, _errorHandling.buildErrorAttribution)()));
|
|
357
351
|
return _context.abrupt("return", false);
|
|
358
352
|
case 10:
|
|
359
353
|
_context.prev = 10;
|
|
@@ -447,15 +441,12 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
|
|
|
447
441
|
(_this$fireAnalyticsEv3 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv3 === void 0 || _this$fireAnalyticsEv3.call(this, (0, _errorHandling.createErrorPayload)('creation complete callback missing', resourceId, (0, _utils.getSourceProductFromResourceIdSafe)(resourceId)));
|
|
448
442
|
}
|
|
449
443
|
if (success) {
|
|
450
|
-
var _this$fireAnalyticsEv4;
|
|
444
|
+
var _this$fireAnalyticsEv4, _this$fireAnalyticsEv5, _this$syncBlockCache$2;
|
|
451
445
|
var sourceProduct = (0, _utils.getSourceProductFromResourceIdSafe)(resourceId);
|
|
452
446
|
(_this$fireAnalyticsEv4 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv4 === void 0 || _this$fireAnalyticsEv4.call(this, (0, _errorHandling.createSuccessPayload)(resourceId || '', sourceProduct));
|
|
453
447
|
// Operational create-success event with the join key + creation-type
|
|
454
448
|
// signals (inputMethod / createdEmpty) captured at the command layer.
|
|
455
|
-
|
|
456
|
-
var _this$fireAnalyticsEv5, _this$syncBlockCache$2;
|
|
457
|
-
(_this$fireAnalyticsEv5 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv5 === void 0 || _this$fireAnalyticsEv5.call(this, (0, _errorHandling.createSuccessOperationalPayload)(resourceId || '', (_this$syncBlockCache$2 = this.syncBlockCache.get(resourceId)) === null || _this$syncBlockCache$2 === void 0 ? void 0 : _this$syncBlockCache$2.blockInstanceId, sourceProduct, this.creationEnrichment.get(resourceId)));
|
|
458
|
-
}
|
|
449
|
+
(_this$fireAnalyticsEv5 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv5 === void 0 || _this$fireAnalyticsEv5.call(this, (0, _errorHandling.createSuccessOperationalPayload)(resourceId || '', (_this$syncBlockCache$2 = this.syncBlockCache.get(resourceId)) === null || _this$syncBlockCache$2 === void 0 ? void 0 : _this$syncBlockCache$2.blockInstanceId, sourceProduct, this.creationEnrichment.get(resourceId)));
|
|
459
450
|
} else {
|
|
460
451
|
var _this$fireAnalyticsEv6;
|
|
461
452
|
// Delete the node from cache if fail to create so it's not flushed to BE
|
|
@@ -474,7 +465,6 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
|
|
|
474
465
|
* Fire the first-content-added event once when a block created empty this
|
|
475
466
|
* session first gains content. The caller detects the in-block edit; this owns
|
|
476
467
|
* dedupe + emission (fires at most once per block, only for empty→content).
|
|
477
|
-
* Gated behind `platform_editor_blocks_patch_4`.
|
|
478
468
|
*/
|
|
479
469
|
}, {
|
|
480
470
|
key: "maybeEmitFirstContentAdded",
|
|
@@ -483,9 +473,6 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
|
|
|
483
473
|
if (this.viewMode === 'view') {
|
|
484
474
|
return;
|
|
485
475
|
}
|
|
486
|
-
if (!(0, _platformFeatureFlags.fg)('platform_editor_blocks_patch_4')) {
|
|
487
|
-
return;
|
|
488
|
-
}
|
|
489
476
|
// `delete` returns false when the id was not tracked (already emitted, or
|
|
490
477
|
// the block was not created empty this session), so this both dedupes and
|
|
491
478
|
// scopes emission to genuine first-content transitions in one check.
|
|
@@ -589,7 +576,7 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
|
|
|
589
576
|
(_this4$createExperien2 = _this4.createExperience) === null || _this4$createExperien2 === void 0 || _this4$createExperien2.failure({
|
|
590
577
|
reason: result.error || 'Failed to create bodied sync block'
|
|
591
578
|
});
|
|
592
|
-
(_this4$fireAnalyticsE = _this4.fireAnalyticsEvent) === null || _this4$fireAnalyticsE === void 0 || _this4$fireAnalyticsE.call(_this4, (0, _errorHandling.createErrorPayload)(result.error || 'Failed to create bodied sync block', resourceId, (0, _utils.getSourceProductFromResourceIdSafe)(resourceId), (0, _errorHandling.buildErrorAttribution)(
|
|
579
|
+
(_this4$fireAnalyticsE = _this4.fireAnalyticsEvent) === null || _this4$fireAnalyticsE === void 0 || _this4$fireAnalyticsE.call(_this4, (0, _errorHandling.createErrorPayload)(result.error || 'Failed to create bodied sync block', resourceId, (0, _utils.getSourceProductFromResourceIdSafe)(resourceId), (0, _errorHandling.buildErrorAttribution)(result.error, result.statusCode)));
|
|
593
580
|
}
|
|
594
581
|
}).catch(function (error) {
|
|
595
582
|
var _this4$createExperien3, _this4$fireAnalyticsE2;
|
|
@@ -644,21 +631,16 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
|
|
|
644
631
|
}
|
|
645
632
|
|
|
646
633
|
/**
|
|
647
|
-
* Emit the `syncedBlockDelete` success event.
|
|
648
|
-
*
|
|
649
|
-
*
|
|
650
|
-
*
|
|
634
|
+
* Emit the `syncedBlockDelete` success event. Attaches `deletionReason`,
|
|
635
|
+
* `mechanism` and `blockInstanceId`, and suppresses repeat emissions within
|
|
636
|
+
* {@link DELETE_DEDUPE_WINDOW_MS}. Must run while the cache entry still exists
|
|
637
|
+
* so `blockInstanceId` is available.
|
|
651
638
|
*/
|
|
652
639
|
}, {
|
|
653
640
|
key: "emitDeleteSuccess",
|
|
654
641
|
value: function emitDeleteSuccess(resourceId, reason, mechanism) {
|
|
655
|
-
var _this$syncBlockCache$3, _this$
|
|
642
|
+
var _this$syncBlockCache$3, _this$fireAnalyticsEv9;
|
|
656
643
|
var sourceProduct = (0, _utils.getSourceProductFromResourceIdSafe)(resourceId);
|
|
657
|
-
if (!(0, _platformFeatureFlags.fg)('platform_editor_blocks_patch_4')) {
|
|
658
|
-
var _this$fireAnalyticsEv9;
|
|
659
|
-
(_this$fireAnalyticsEv9 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv9 === void 0 || _this$fireAnalyticsEv9.call(this, (0, _errorHandling.deleteSuccessPayload)(resourceId, sourceProduct));
|
|
660
|
-
return;
|
|
661
|
-
}
|
|
662
644
|
var now = Date.now();
|
|
663
645
|
var lastEmittedAt = this.recentDeleteEmissions.get(resourceId);
|
|
664
646
|
if (lastEmittedAt !== undefined && now - lastEmittedAt < DELETE_DEDUPE_WINDOW_MS) {
|
|
@@ -671,14 +653,14 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
|
|
|
671
653
|
deletionReason: reason,
|
|
672
654
|
mechanism: mechanism
|
|
673
655
|
};
|
|
674
|
-
(_this$
|
|
656
|
+
(_this$fireAnalyticsEv9 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv9 === void 0 || _this$fireAnalyticsEv9.call(this, (0, _errorHandling.deleteSuccessPayload)(resourceId, sourceProduct, enrichment));
|
|
675
657
|
}
|
|
676
658
|
}, {
|
|
677
659
|
key: "delete",
|
|
678
660
|
value: function () {
|
|
679
661
|
var _delete2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(syncBlockIds, onDelete, onDeleteCompleted, reason, mechanism) {
|
|
680
662
|
var _this5 = this;
|
|
681
|
-
var _this$deleteExperienc, results, callback, isDeleteSuccessful, _this$deleteExperienc2, _this$deleteExperienc3,
|
|
663
|
+
var _this$deleteExperienc, results, callback, isDeleteSuccessful, _this$deleteExperienc2, _this$deleteExperienc3, attribution, _t2;
|
|
682
664
|
return _regenerator.default.wrap(function (_context2) {
|
|
683
665
|
while (1) switch (_context2.prev = _context2.next) {
|
|
684
666
|
case 0:
|
|
@@ -726,13 +708,12 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
|
|
|
726
708
|
_this5.setPendingDeletion(Ids, false);
|
|
727
709
|
};
|
|
728
710
|
(_this$deleteExperienc3 = this.deleteExperience) === null || _this$deleteExperienc3 === void 0 || _this$deleteExperienc3.failure();
|
|
729
|
-
attributionEnabled = (0, _platformFeatureFlags.fg)('platform_editor_blocks_patch_3');
|
|
730
711
|
results.forEach(function (result) {
|
|
731
712
|
if (result.success) {
|
|
732
713
|
_this5.emitDeleteSuccess(result.resourceId, reason, mechanism);
|
|
733
714
|
} else {
|
|
734
715
|
var _this5$fireAnalyticsE;
|
|
735
|
-
(_this5$fireAnalyticsE = _this5.fireAnalyticsEvent) === null || _this5$fireAnalyticsE === void 0 || _this5$fireAnalyticsE.call(_this5, (0, _errorHandling.deleteErrorPayload)(result.error || 'Failed to delete synced block', result.resourceId, (0, _utils.getSourceProductFromResourceIdSafe)(result.resourceId), (0, _errorHandling.buildErrorAttribution)(
|
|
716
|
+
(_this5$fireAnalyticsE = _this5.fireAnalyticsEvent) === null || _this5$fireAnalyticsE === void 0 || _this5$fireAnalyticsE.call(_this5, (0, _errorHandling.deleteErrorPayload)(result.error || 'Failed to delete synced block', result.resourceId, (0, _utils.getSourceProductFromResourceIdSafe)(result.resourceId), (0, _errorHandling.buildErrorAttribution)(result.error, result.statusCode)));
|
|
736
717
|
}
|
|
737
718
|
});
|
|
738
719
|
}
|
|
@@ -742,8 +723,8 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
|
|
|
742
723
|
_context2.prev = 4;
|
|
743
724
|
_t2 = _context2["catch"](0);
|
|
744
725
|
// Thrown (non-result) failure — no structured SyncBlockError/status is available,
|
|
745
|
-
// so the attribution `reason` falls back to `unknown
|
|
746
|
-
attribution = (0, _errorHandling.buildErrorAttribution)(
|
|
726
|
+
// so the attribution `reason` falls back to `unknown`.
|
|
727
|
+
attribution = (0, _errorHandling.buildErrorAttribution)();
|
|
747
728
|
syncBlockIds.forEach(function (Ids) {
|
|
748
729
|
var _this5$fireAnalyticsE2;
|
|
749
730
|
_this5.setPendingDeletion(Ids, false);
|
|
@@ -1020,11 +1001,11 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
|
|
|
1020
1001
|
return sourceInfo;
|
|
1021
1002
|
});
|
|
1022
1003
|
} catch (error) {
|
|
1023
|
-
var _this$
|
|
1004
|
+
var _this$fireAnalyticsEv0;
|
|
1024
1005
|
(0, _monitoring.logException)(error, {
|
|
1025
1006
|
location: 'editor-synced-block-provider/sourceSyncBlockStoreManager'
|
|
1026
1007
|
});
|
|
1027
|
-
(_this$
|
|
1008
|
+
(_this$fireAnalyticsEv0 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv0 === void 0 || _this$fireAnalyticsEv0.call(this, (0, _errorHandling.getSourceInfoErrorPayload)(error.message));
|
|
1028
1009
|
return Promise.resolve(undefined);
|
|
1029
1010
|
}
|
|
1030
1011
|
}
|
|
@@ -1037,11 +1018,11 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
|
|
|
1037
1018
|
}
|
|
1038
1019
|
return this.dataProvider.fetchReferences(resourceId, true);
|
|
1039
1020
|
} catch (error) {
|
|
1040
|
-
var _this$
|
|
1021
|
+
var _this$fireAnalyticsEv1;
|
|
1041
1022
|
(0, _monitoring.logException)(error, {
|
|
1042
1023
|
location: 'editor-synced-block-provider/sourceSyncBlockStoreManager'
|
|
1043
1024
|
});
|
|
1044
|
-
(_this$
|
|
1025
|
+
(_this$fireAnalyticsEv1 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv1 === void 0 || _this$fireAnalyticsEv1.call(this, (0, _errorHandling.fetchReferencesErrorPayload)(error.message, resourceId, (0, _utils.getSourceProductFromResourceIdSafe)(resourceId)));
|
|
1045
1026
|
return Promise.resolve({
|
|
1046
1027
|
error: _types.SyncBlockError.Errored
|
|
1047
1028
|
});
|
|
@@ -10,7 +10,6 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
|
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
11
|
var _rafSchd = _interopRequireDefault(require("raf-schd"));
|
|
12
12
|
var _monitoring = require("@atlaskit/editor-common/monitoring");
|
|
13
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
13
|
var _types = require("../common/types");
|
|
15
14
|
var _errorHandling = require("../utils/errorHandling");
|
|
16
15
|
var _utils = require("../utils/utils");
|
|
@@ -36,14 +35,9 @@ var SyncBlockBatchFetcher = exports.SyncBlockBatchFetcher = /*#__PURE__*/functio
|
|
|
36
35
|
}
|
|
37
36
|
|
|
38
37
|
// EDITOR-7860: not ready — skip and leave resourceIds queued for the
|
|
39
|
-
// next batch once the provider resolves.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
// exposure is still tracked — satisfies @atlaskit/platform/no-preconditioning).
|
|
43
|
-
if ((0, _platformFeatureFlags.fg)('platform_editor_blocks_patch_3')) {
|
|
44
|
-
if (_this.deps.isProviderReady && !_this.deps.isProviderReady()) {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
38
|
+
// next batch once the provider resolves.
|
|
39
|
+
if (_this.deps.isProviderReady && !_this.deps.isProviderReady()) {
|
|
40
|
+
return;
|
|
47
41
|
}
|
|
48
42
|
var resourceIds = Array.from(_this.pendingFetchRequests);
|
|
49
43
|
var syncBlockNodes = resourceIds.map(function (resId) {
|
|
@@ -62,8 +56,8 @@ var SyncBlockBatchFetcher = exports.SyncBlockBatchFetcher = /*#__PURE__*/functio
|
|
|
62
56
|
// nothing (no analytics, no exception-tracker noise). Checked before
|
|
63
57
|
// `logException` so the benign case stays silent. Re-schedule so the
|
|
64
58
|
// re-queued IDs are retried on the next frame even if no further
|
|
65
|
-
// `queueFetch()` arrives.
|
|
66
|
-
if ((0, _types.isProviderNotReadyError)(error)
|
|
59
|
+
// `queueFetch()` arrives.
|
|
60
|
+
if ((0, _types.isProviderNotReadyError)(error)) {
|
|
67
61
|
resourceIds.forEach(function (resId) {
|
|
68
62
|
return _this.pendingFetchRequests.add(resId);
|
|
69
63
|
});
|
|
@@ -75,7 +69,7 @@ var SyncBlockBatchFetcher = exports.SyncBlockBatchFetcher = /*#__PURE__*/functio
|
|
|
75
69
|
(0, _monitoring.logException)(error, {
|
|
76
70
|
location: 'editor-synced-block-provider/syncBlockBatchFetcher/batchedFetchSyncBlocks'
|
|
77
71
|
});
|
|
78
|
-
var attribution = (0, _errorHandling.buildFetchErrorAttribution)(
|
|
72
|
+
var attribution = (0, _errorHandling.buildFetchErrorAttribution)(error.message);
|
|
79
73
|
resourceIds.forEach(function (resId) {
|
|
80
74
|
var _this$deps$getFireAna;
|
|
81
75
|
(_this$deps$getFireAna = _this.deps.getFireAnalyticsEvent()) === null || _this$deps$getFireAna === void 0 || _this$deps$getFireAna((0, _errorHandling.fetchErrorPayload)(error.message, resId, (0, _utils.getSourceProductFromResourceIdSafe)(resId), attribution));
|
|
@@ -35,7 +35,7 @@ var SyncBlockProviderFactoryManager = exports.SyncBlockProviderFactoryManager =
|
|
|
35
35
|
(0, _monitoring.logException)(error, {
|
|
36
36
|
location: 'editor-synced-block-provider/syncBlockProviderFactoryManager'
|
|
37
37
|
});
|
|
38
|
-
(_this$deps$getFireAna = this.deps.getFireAnalyticsEvent()) === null || _this$deps$getFireAna === void 0 || _this$deps$getFireAna((0, _errorHandling.fetchErrorPayload)(error.message, resourceId, (0, _utils.getSourceProductFromResourceIdSafe)(resourceId), (0, _errorHandling.buildFetchErrorAttribution)(
|
|
38
|
+
(_this$deps$getFireAna = this.deps.getFireAnalyticsEvent()) === null || _this$deps$getFireAna === void 0 || _this$deps$getFireAna((0, _errorHandling.fetchErrorPayload)(error.message, resourceId, (0, _utils.getSourceProductFromResourceIdSafe)(resourceId), (0, _errorHandling.buildFetchErrorAttribution)(error.message)));
|
|
39
39
|
return undefined;
|
|
40
40
|
}
|
|
41
41
|
var providerFactory = this.providerFactories.get(resourceId);
|
|
@@ -111,7 +111,7 @@ var SyncBlockProviderFactoryManager = exports.SyncBlockProviderFactoryManager =
|
|
|
111
111
|
(0, _monitoring.logException)(error, {
|
|
112
112
|
location: 'editor-synced-block-provider/syncBlockProviderFactoryManager'
|
|
113
113
|
});
|
|
114
|
-
(_this$deps$getFireAna2 = this.deps.getFireAnalyticsEvent()) === null || _this$deps$getFireAna2 === void 0 || _this$deps$getFireAna2((0, _errorHandling.fetchErrorPayload)(error.message, resourceId, (0, _utils.getSourceProductFromResourceIdSafe)(resourceId), (0, _errorHandling.buildFetchErrorAttribution)(
|
|
114
|
+
(_this$deps$getFireAna2 = this.deps.getFireAnalyticsEvent()) === null || _this$deps$getFireAna2 === void 0 || _this$deps$getFireAna2((0, _errorHandling.fetchErrorPayload)(error.message, resourceId, (0, _utils.getSourceProductFromResourceIdSafe)(resourceId), (0, _errorHandling.buildFetchErrorAttribution)(error.message)));
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
}, {
|
|
@@ -194,7 +194,7 @@ var SyncBlockProviderFactoryManager = exports.SyncBlockProviderFactoryManager =
|
|
|
194
194
|
if (!syncBlock.data.sourceAri || !syncBlock.data.product) {
|
|
195
195
|
var _this$deps$getFireAna3, _syncBlock$data$produ;
|
|
196
196
|
(_this$deps$getFireAna3 = this.deps.getFireAnalyticsEvent()) === null || _this$deps$getFireAna3 === void 0 || _this$deps$getFireAna3((0, _errorHandling.fetchErrorPayload)('Sync block source ari or product not found', resourceId, // Prefer cached product when available; fall back to parsing resourceId.
|
|
197
|
-
(_syncBlock$data$produ = syncBlock.data.product) !== null && _syncBlock$data$produ !== void 0 ? _syncBlock$data$produ : (0, _utils.getSourceProductFromResourceIdSafe)(resourceId), (0, _errorHandling.buildFetchErrorAttribution)(
|
|
197
|
+
(_syncBlock$data$produ = syncBlock.data.product) !== null && _syncBlock$data$produ !== void 0 ? _syncBlock$data$produ : (0, _utils.getSourceProductFromResourceIdSafe)(resourceId), (0, _errorHandling.buildFetchErrorAttribution)('Sync block source ari or product not found')));
|
|
198
198
|
return;
|
|
199
199
|
}
|
|
200
200
|
var parentInfo = dataProvider.retrieveSyncBlockParentInfo(syncBlock.data.sourceAri, syncBlock.data.product);
|