@atlaskit/editor-synced-block-provider 10.0.2 → 10.0.4
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 +14 -0
- package/dist/cjs/common/types.js +1 -2
- package/dist/cjs/hooks/useFetchSyncBlockData.js +4 -4
- package/dist/cjs/store-manager/referenceSyncBlockStoreManager.js +24 -49
- package/dist/cjs/store-manager/sourceSyncBlockStoreManager.js +17 -36
- 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 +11 -52
- package/dist/cjs/utils/errorHandling.js +10 -29
- package/dist/es2019/common/types.js +1 -2
- package/dist/es2019/hooks/useFetchSyncBlockData.js +4 -5
- package/dist/es2019/store-manager/referenceSyncBlockStoreManager.js +23 -45
- package/dist/es2019/store-manager/sourceSyncBlockStoreManager.js +18 -37
- 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 +16 -57
- package/dist/es2019/utils/errorHandling.js +10 -29
- package/dist/esm/common/types.js +1 -2
- package/dist/esm/hooks/useFetchSyncBlockData.js +4 -4
- package/dist/esm/store-manager/referenceSyncBlockStoreManager.js +24 -49
- package/dist/esm/store-manager/sourceSyncBlockStoreManager.js +17 -36
- 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 +11 -52
- package/dist/esm/utils/errorHandling.js +10 -29
- package/dist/types/common/types.d.ts +1 -2
- package/dist/types/store-manager/referenceSyncBlockStoreManager.d.ts +3 -3
- package/dist/types/store-manager/sourceSyncBlockStoreManager.d.ts +1 -3
- package/dist/types/store-manager/syncBlockSubscriptionManager.d.ts +0 -1
- package/dist/types/utils/errorHandling.d.ts +10 -23
- package/package.json +3 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-synced-block-provider
|
|
2
2
|
|
|
3
|
+
## 10.0.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`0b4753c0a8c07`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0b4753c0a8c07) -
|
|
8
|
+
Clean up feature gates from completed rollout
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 10.0.3
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 10.0.2
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/dist/cjs/common/types.js
CHANGED
|
@@ -54,8 +54,7 @@ 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.
|
|
@@ -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).
|
|
@@ -63,7 +62,7 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
63
62
|
(0, _defineProperty2.default)(this, "entityNotFoundRetryCount", new Map());
|
|
64
63
|
(0, _defineProperty2.default)(this, "entityNotFoundRetryTimers", new Map());
|
|
65
64
|
// Pending cache deletion timers keyed by resourceId (gated by
|
|
66
|
-
//
|
|
65
|
+
// Cancelled when a subscriber re-attaches.
|
|
67
66
|
(0, _defineProperty2.default)(this, "pendingCacheDeletions", new Map());
|
|
68
67
|
// Reschedule counter per resource — reset on actual deletion or re-subscribe.
|
|
69
68
|
(0, _defineProperty2.default)(this, "cacheDeletionRescheduleCounts", new Map());
|
|
@@ -100,7 +99,7 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
100
99
|
_this.isCacheDirty = true;
|
|
101
100
|
},
|
|
102
101
|
// Delegate cache lifecycle to the store manager so guards can be
|
|
103
|
-
// checked atomically
|
|
102
|
+
// checked atomically.
|
|
104
103
|
scheduleCacheDeletion: function scheduleCacheDeletion(rid) {
|
|
105
104
|
return _this.scheduleCacheDeletion(rid);
|
|
106
105
|
},
|
|
@@ -548,28 +547,22 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
548
547
|
return _context2.abrupt("return");
|
|
549
548
|
case 2:
|
|
550
549
|
if (this.dataProvider) {
|
|
551
|
-
_context2.next = 4;
|
|
552
|
-
break;
|
|
553
|
-
}
|
|
554
|
-
if (!(0, _platformFeatureFlags.fg)('platform_editor_blocks_patch_3')) {
|
|
555
550
|
_context2.next = 3;
|
|
556
551
|
break;
|
|
557
552
|
}
|
|
558
553
|
throw new _types.ProviderNotReadyError();
|
|
559
554
|
case 3:
|
|
560
|
-
throw new Error('Data provider not set');
|
|
561
|
-
case 4:
|
|
562
555
|
nodesToFetch.forEach(function (node) {
|
|
563
556
|
_this4.syncBlockFetchDataRequests.set(node.attrs.resourceId, true);
|
|
564
557
|
});
|
|
565
558
|
(_this$fetchExperience6 = this.fetchExperience) === null || _this$fetchExperience6 === void 0 || _this$fetchExperience6.start({});
|
|
566
|
-
_context2.next =
|
|
559
|
+
_context2.next = 4;
|
|
567
560
|
return this.dataProvider.fetchNodesData(nodesToFetch).finally(function () {
|
|
568
561
|
nodesToFetch.forEach(function (node) {
|
|
569
562
|
_this4.syncBlockFetchDataRequests.delete(node.attrs.resourceId);
|
|
570
563
|
});
|
|
571
564
|
});
|
|
572
|
-
case
|
|
565
|
+
case 4:
|
|
573
566
|
data = _context2.sent;
|
|
574
567
|
_this$processFetchedD2 = this.processFetchedData(data), hasUnexpectedError = _this$processFetchedD2.hasUnexpectedError, hasExpectedError = _this$processFetchedD2.hasExpectedError;
|
|
575
568
|
if (hasUnexpectedError) {
|
|
@@ -583,7 +576,7 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
583
576
|
} else {
|
|
584
577
|
(_this$fetchExperience9 = this.fetchExperience) === null || _this$fetchExperience9 === void 0 || _this$fetchExperience9.success();
|
|
585
578
|
}
|
|
586
|
-
case
|
|
579
|
+
case 5:
|
|
587
580
|
case "end":
|
|
588
581
|
return _context2.stop();
|
|
589
582
|
}
|
|
@@ -614,7 +607,7 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
614
607
|
// No resourceId means we cannot derive a sourceProduct here; intentionally omit.
|
|
615
608
|
// Classify on the structured `type` first, falling back to the free-text
|
|
616
609
|
// `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)((
|
|
610
|
+
(_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
611
|
return;
|
|
619
612
|
}
|
|
620
613
|
var existingSyncBlock = _this5.getFromCache(syncBlockInstance.resourceId);
|
|
@@ -645,13 +638,13 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
645
638
|
var _this5$entityNotFound;
|
|
646
639
|
// Skip error analytics when EntityNotFound will be retried, to avoid
|
|
647
640
|
// 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
|
|
641
|
+
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
642
|
if (!isRetryingEntityNotFound) {
|
|
650
643
|
var _this5$fireAnalyticsE2, _syncBlockInstance$da, _syncBlockInstance$da2;
|
|
651
644
|
// Classify on the structured `type` (a `SyncBlockError` enum value) first,
|
|
652
645
|
// falling back to the free-text `reason` so source-state/permission strings
|
|
653
646
|
// 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)(
|
|
647
|
+
(_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
648
|
}
|
|
656
649
|
if (syncBlockInstance.error.type === _types.SyncBlockError.NotFound || syncBlockInstance.error.type === _types.SyncBlockError.Forbidden) {
|
|
657
650
|
hasExpectedError = true;
|
|
@@ -659,9 +652,7 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
659
652
|
// Schedule a retry for EntityNotFound — the source block may be in
|
|
660
653
|
// the process of being created by a collaborator (race condition
|
|
661
654
|
// between NCS propagation and Block Service createBlock call).
|
|
662
|
-
|
|
663
|
-
_this5.scheduleEntityNotFoundRetry(syncBlockInstance.resourceId);
|
|
664
|
-
}
|
|
655
|
+
_this5.scheduleEntityNotFoundRetry(syncBlockInstance.resourceId);
|
|
665
656
|
if (!isRetryingEntityNotFound) {
|
|
666
657
|
hasUnexpectedError = true;
|
|
667
658
|
}
|
|
@@ -689,7 +680,7 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
689
680
|
var existingSyncBlock = this.getFromCache(resourceId);
|
|
690
681
|
// If the cache entry was deleted while the source-info request was
|
|
691
682
|
// in flight, fire an analytics event so the race is observable.
|
|
692
|
-
if (!existingSyncBlock
|
|
683
|
+
if (!existingSyncBlock) {
|
|
693
684
|
var _this$fireAnalyticsEv5;
|
|
694
685
|
(_this$fireAnalyticsEv5 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv5 === void 0 || _this$fireAnalyticsEv5.call(this, (0, _errorHandling.sourceInfoOrphanedPayload)(resourceId, (0, _utils.getSourceProductFromResourceIdSafe)(resourceId), {
|
|
695
686
|
hasPendingDeletion: this.pendingCacheDeletions.has(resourceId),
|
|
@@ -742,16 +733,14 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
742
733
|
this._providerFactoryManager.deleteFactory(resourceId);
|
|
743
734
|
// Evict in-flight source-info promise and reset reschedule counter
|
|
744
735
|
// so a stale resolution can't silently merge into a re-fetched entry.
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
this.cacheDeletionRescheduleCounts.delete(resourceId);
|
|
748
|
-
}
|
|
736
|
+
this.syncBlockSourceInfoRequests.delete(resourceId);
|
|
737
|
+
this.cacheDeletionRescheduleCounts.delete(resourceId);
|
|
749
738
|
}
|
|
750
739
|
|
|
751
740
|
/**
|
|
752
741
|
* Returns true if the cache entry for `resourceId` is safe to delete:
|
|
753
742
|
* no active subscribers, no in-flight source-info request, and no
|
|
754
|
-
* queued/in-flight batch fetch
|
|
743
|
+
* queued/in-flight batch fetch.
|
|
755
744
|
*/
|
|
756
745
|
}, {
|
|
757
746
|
key: "canDeleteCache",
|
|
@@ -770,7 +759,7 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
770
759
|
|
|
771
760
|
/**
|
|
772
761
|
* Schedules cache deletion for `resourceId` after the grace period
|
|
773
|
-
*
|
|
762
|
+
* Called when the last
|
|
774
763
|
* subscriber unsubscribes. Guards are re-checked at fire time; if any
|
|
775
764
|
* are positive the timer is rescheduled up to MAX_RESCHEDULES times.
|
|
776
765
|
*/
|
|
@@ -778,9 +767,6 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
778
767
|
key: "scheduleCacheDeletion",
|
|
779
768
|
value: function scheduleCacheDeletion(resourceId) {
|
|
780
769
|
var _this6 = this;
|
|
781
|
-
if (!(0, _platformFeatureFlags.fg)('platform_synced_block_patch_14')) {
|
|
782
|
-
return;
|
|
783
|
-
}
|
|
784
770
|
if (this.isDestroyed) {
|
|
785
771
|
return;
|
|
786
772
|
}
|
|
@@ -808,15 +794,12 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
808
794
|
|
|
809
795
|
/**
|
|
810
796
|
* Cancels any pending cache deletion timer for `resourceId` and resets the
|
|
811
|
-
* reschedule counter
|
|
797
|
+
* reschedule counter. Called
|
|
812
798
|
* when a new subscriber arrives.
|
|
813
799
|
*/
|
|
814
800
|
}, {
|
|
815
801
|
key: "cancelPendingCacheDeletion",
|
|
816
802
|
value: function cancelPendingCacheDeletion(resourceId) {
|
|
817
|
-
if (!(0, _platformFeatureFlags.fg)('platform_synced_block_patch_14')) {
|
|
818
|
-
return;
|
|
819
|
-
}
|
|
820
803
|
var existing = this.pendingCacheDeletions.get(resourceId);
|
|
821
804
|
if (existing) {
|
|
822
805
|
clearTimeout(existing);
|
|
@@ -968,14 +951,14 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
968
951
|
var _this$fireAnalyticsEv7;
|
|
969
952
|
// EDITOR-7860: benign not-ready/torn-down case — suppress both the
|
|
970
953
|
// exception-tracker log and the analytics event (checked first so the
|
|
971
|
-
// benign case stays fully silent).
|
|
972
|
-
if ((0, _types.isProviderNotReadyError)(error)
|
|
954
|
+
// benign case stays fully silent).
|
|
955
|
+
if ((0, _types.isProviderNotReadyError)(error)) {
|
|
973
956
|
return function () {};
|
|
974
957
|
}
|
|
975
958
|
(0, _monitoring.logException)(error, {
|
|
976
959
|
location: 'editor-synced-block-provider/referenceSyncBlockStoreManager'
|
|
977
960
|
});
|
|
978
|
-
(_this$fireAnalyticsEv7 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv7 === void 0 || _this$fireAnalyticsEv7.call(this, (0, _errorHandling.fetchErrorPayload)(error.message, undefined, undefined, (0, _errorHandling.buildFetchErrorAttribution)(
|
|
961
|
+
(_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
962
|
return function () {};
|
|
980
963
|
}
|
|
981
964
|
}
|
|
@@ -1138,7 +1121,7 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
1138
1121
|
(_this$saveExperience2 = this.saveExperience) === null || _this$saveExperience2 === void 0 || _this$saveExperience2.failure({
|
|
1139
1122
|
reason: updateResult.error || 'Failed to update reference synced blocks on the document'
|
|
1140
1123
|
});
|
|
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)(
|
|
1124
|
+
(_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
1125
|
}
|
|
1143
1126
|
_context4.next = 17;
|
|
1144
1127
|
break;
|
|
@@ -1155,7 +1138,7 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
1155
1138
|
// No `resourceId` available in this catch — sourceProduct is intentionally omitted.
|
|
1156
1139
|
// No structured SyncBlockError/status here, so the attribution `reason` falls back
|
|
1157
1140
|
// to `unknown` when the gate is on.
|
|
1158
|
-
(_this$fireAnalyticsEv9 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv9 === void 0 || _this$fireAnalyticsEv9.call(this, (0, _errorHandling.updateReferenceErrorPayload)(_t3.message, undefined, undefined, (0, _errorHandling.buildErrorAttribution)(
|
|
1141
|
+
(_this$fireAnalyticsEv9 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv9 === void 0 || _this$fireAnalyticsEv9.call(this, (0, _errorHandling.updateReferenceErrorPayload)(_t3.message, undefined, undefined, (0, _errorHandling.buildErrorAttribution)()));
|
|
1159
1142
|
case 17:
|
|
1160
1143
|
_context4.prev = 17;
|
|
1161
1144
|
if (!success) {
|
|
@@ -1237,17 +1220,9 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
1237
1220
|
});
|
|
1238
1221
|
this.fireAnalyticsEvent = undefined;
|
|
1239
1222
|
|
|
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
|
-
}
|
|
1223
|
+
// `destroy()` is wired to React component unmount via
|
|
1224
|
+
// `useMemoizedSyncBlockStoreManager`. Let the in-memory session cache age
|
|
1225
|
+
// out naturally instead of clearing it during a view-mode transition.
|
|
1251
1226
|
}
|
|
1252
1227
|
}]);
|
|
1253
1228
|
}();
|
|
@@ -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;
|
|
@@ -652,13 +639,8 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
|
|
|
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
|
}
|
|
@@ -743,7 +724,7 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
|
|
|
743
724
|
_t2 = _context2["catch"](0);
|
|
744
725
|
// Thrown (non-result) failure — no structured SyncBlockError/status is available,
|
|
745
726
|
// so the attribution `reason` falls back to `unknown` when the gate is on.
|
|
746
|
-
attribution = (0, _errorHandling.buildErrorAttribution)(
|
|
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);
|
|
@@ -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 _react = require("react");
|
|
14
14
|
var _monitoring = require("@atlaskit/editor-common/monitoring");
|
|
15
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
15
|
var _ari = require("../clients/block-service/ari");
|
|
17
16
|
var _types = require("../common/types");
|
|
18
17
|
var _errorHandling = require("../utils/errorHandling");
|
|
@@ -308,7 +307,6 @@ var useMemoizedSyncBlockStoreManager = exports.useMemoizedSyncBlockStoreManager
|
|
|
308
307
|
syncBlockStoreManager.setFireAnalyticsEvent(fireAnalyticsEvent);
|
|
309
308
|
}
|
|
310
309
|
|
|
311
|
-
// Gated by platform_synced_block_patch_14:
|
|
312
310
|
// Destroy the SyncBlockStoreManager when:
|
|
313
311
|
// (a) the component unmounts — manager is fully cleaned up, or
|
|
314
312
|
// (b) dataProvider changes — the old manager (now orphaned by the
|
|
@@ -320,9 +318,7 @@ var useMemoizedSyncBlockStoreManager = exports.useMemoizedSyncBlockStoreManager
|
|
|
320
318
|
// changes, triggering the cleanup for the old instance.
|
|
321
319
|
(0, _react.useEffect)(function () {
|
|
322
320
|
return function () {
|
|
323
|
-
|
|
324
|
-
syncBlockStoreManager.destroy();
|
|
325
|
-
}
|
|
321
|
+
syncBlockStoreManager.destroy();
|
|
326
322
|
};
|
|
327
323
|
}, [syncBlockStoreManager]);
|
|
328
324
|
return syncBlockStoreManager;
|