@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
|
@@ -11,7 +11,6 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
11
11
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
12
12
|
import isEqual from 'lodash/isEqual';
|
|
13
13
|
import { logException } from '@atlaskit/editor-common/monitoring';
|
|
14
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
15
14
|
import { isProviderNotReadyError, ProviderNotReadyError, SyncBlockError } from '../common/types';
|
|
16
15
|
import { buildErrorAttribution, buildFetchErrorAttribution, cacheDeletionForcedPayload, fetchErrorPayload, fetchSuccessPayload, getSourceInfoErrorPayload, sourceInfoOrphanedPayload, updateReferenceErrorPayload } from '../utils/errorHandling';
|
|
17
16
|
import { getFetchExperience, getFetchSourceInfoExperience, getSaveReferenceExperience } from '../utils/experienceTracking';
|
|
@@ -26,7 +25,7 @@ var ENTITY_NOT_FOUND_MAX_RETRIES = 3;
|
|
|
26
25
|
var ENTITY_NOT_FOUND_INITIAL_DELAY_MS = 2000;
|
|
27
26
|
|
|
28
27
|
// Grace period before a cache entry is removed after the last subscriber
|
|
29
|
-
// unsubscribes
|
|
28
|
+
// unsubscribes. Guards are
|
|
30
29
|
// re-checked at fire time; if any are positive, the timer is rescheduled.
|
|
31
30
|
var CACHE_DELETION_GRACE_PERIOD_MS = 30000;
|
|
32
31
|
// Max reschedules before force-deleting with an analytics event (~5 min).
|
|
@@ -56,7 +55,7 @@ export var ReferenceSyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
56
55
|
_defineProperty(this, "entityNotFoundRetryCount", new Map());
|
|
57
56
|
_defineProperty(this, "entityNotFoundRetryTimers", new Map());
|
|
58
57
|
// Pending cache deletion timers keyed by resourceId (gated by
|
|
59
|
-
//
|
|
58
|
+
// Cancelled when a subscriber re-attaches.
|
|
60
59
|
_defineProperty(this, "pendingCacheDeletions", new Map());
|
|
61
60
|
// Reschedule counter per resource — reset on actual deletion or re-subscribe.
|
|
62
61
|
_defineProperty(this, "cacheDeletionRescheduleCounts", new Map());
|
|
@@ -93,7 +92,7 @@ export var ReferenceSyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
93
92
|
_this.isCacheDirty = true;
|
|
94
93
|
},
|
|
95
94
|
// Delegate cache lifecycle to the store manager so guards can be
|
|
96
|
-
// checked atomically
|
|
95
|
+
// checked atomically.
|
|
97
96
|
scheduleCacheDeletion: function scheduleCacheDeletion(rid) {
|
|
98
97
|
return _this.scheduleCacheDeletion(rid);
|
|
99
98
|
},
|
|
@@ -541,28 +540,22 @@ export var ReferenceSyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
541
540
|
return _context2.abrupt("return");
|
|
542
541
|
case 2:
|
|
543
542
|
if (this.dataProvider) {
|
|
544
|
-
_context2.next = 4;
|
|
545
|
-
break;
|
|
546
|
-
}
|
|
547
|
-
if (!fg('platform_editor_blocks_patch_3')) {
|
|
548
543
|
_context2.next = 3;
|
|
549
544
|
break;
|
|
550
545
|
}
|
|
551
546
|
throw new ProviderNotReadyError();
|
|
552
547
|
case 3:
|
|
553
|
-
throw new Error('Data provider not set');
|
|
554
|
-
case 4:
|
|
555
548
|
nodesToFetch.forEach(function (node) {
|
|
556
549
|
_this4.syncBlockFetchDataRequests.set(node.attrs.resourceId, true);
|
|
557
550
|
});
|
|
558
551
|
(_this$fetchExperience6 = this.fetchExperience) === null || _this$fetchExperience6 === void 0 || _this$fetchExperience6.start({});
|
|
559
|
-
_context2.next =
|
|
552
|
+
_context2.next = 4;
|
|
560
553
|
return this.dataProvider.fetchNodesData(nodesToFetch).finally(function () {
|
|
561
554
|
nodesToFetch.forEach(function (node) {
|
|
562
555
|
_this4.syncBlockFetchDataRequests.delete(node.attrs.resourceId);
|
|
563
556
|
});
|
|
564
557
|
});
|
|
565
|
-
case
|
|
558
|
+
case 4:
|
|
566
559
|
data = _context2.sent;
|
|
567
560
|
_this$processFetchedD2 = this.processFetchedData(data), hasUnexpectedError = _this$processFetchedD2.hasUnexpectedError, hasExpectedError = _this$processFetchedD2.hasExpectedError;
|
|
568
561
|
if (hasUnexpectedError) {
|
|
@@ -576,7 +569,7 @@ export var ReferenceSyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
576
569
|
} else {
|
|
577
570
|
(_this$fetchExperience9 = this.fetchExperience) === null || _this$fetchExperience9 === void 0 || _this$fetchExperience9.success();
|
|
578
571
|
}
|
|
579
|
-
case
|
|
572
|
+
case 5:
|
|
580
573
|
case "end":
|
|
581
574
|
return _context2.stop();
|
|
582
575
|
}
|
|
@@ -607,7 +600,7 @@ export var ReferenceSyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
607
600
|
// No resourceId means we cannot derive a sourceProduct here; intentionally omit.
|
|
608
601
|
// Classify on the structured `type` first, falling back to the free-text
|
|
609
602
|
// `reason`/payload (EDITOR-7862).
|
|
610
|
-
(_this5$fireAnalyticsE = _this5.fireAnalyticsEvent) === null || _this5$fireAnalyticsE === void 0 || _this5$fireAnalyticsE.call(_this5, fetchErrorPayload(payload, undefined, undefined, buildFetchErrorAttribution(
|
|
603
|
+
(_this5$fireAnalyticsE = _this5.fireAnalyticsEvent) === null || _this5$fireAnalyticsE === void 0 || _this5$fireAnalyticsE.call(_this5, fetchErrorPayload(payload, undefined, undefined, 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)));
|
|
611
604
|
return;
|
|
612
605
|
}
|
|
613
606
|
var existingSyncBlock = _this5.getFromCache(syncBlockInstance.resourceId);
|
|
@@ -638,13 +631,13 @@ export var ReferenceSyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
638
631
|
var _this5$entityNotFound;
|
|
639
632
|
// Skip error analytics when EntityNotFound will be retried, to avoid
|
|
640
633
|
// inflating error-rate metrics with expected transient failures
|
|
641
|
-
var isRetryingEntityNotFound = syncBlockInstance.error.type === SyncBlockError.EntityNotFound && ((_this5$entityNotFound = _this5.entityNotFoundRetryCount.get(syncBlockInstance.resourceId)) !== null && _this5$entityNotFound !== void 0 ? _this5$entityNotFound : 0) < ENTITY_NOT_FOUND_MAX_RETRIES
|
|
634
|
+
var isRetryingEntityNotFound = syncBlockInstance.error.type === SyncBlockError.EntityNotFound && ((_this5$entityNotFound = _this5.entityNotFoundRetryCount.get(syncBlockInstance.resourceId)) !== null && _this5$entityNotFound !== void 0 ? _this5$entityNotFound : 0) < ENTITY_NOT_FOUND_MAX_RETRIES;
|
|
642
635
|
if (!isRetryingEntityNotFound) {
|
|
643
636
|
var _this5$fireAnalyticsE2, _syncBlockInstance$da, _syncBlockInstance$da2;
|
|
644
637
|
// Classify on the structured `type` (a `SyncBlockError` enum value) first,
|
|
645
638
|
// falling back to the free-text `reason` so source-state/permission strings
|
|
646
639
|
// are still bucketed (EDITOR-7862). The emitted `error` attribute is unchanged.
|
|
647
|
-
(_this5$fireAnalyticsE2 = _this5.fireAnalyticsEvent) === null || _this5$fireAnalyticsE2 === void 0 || _this5$fireAnalyticsE2.call(_this5, 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 : getSourceProductFromResourceIdSafe(syncBlockInstance.resourceId), buildFetchErrorAttribution(
|
|
640
|
+
(_this5$fireAnalyticsE2 = _this5.fireAnalyticsEvent) === null || _this5$fireAnalyticsE2 === void 0 || _this5$fireAnalyticsE2.call(_this5, 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 : getSourceProductFromResourceIdSafe(syncBlockInstance.resourceId), buildFetchErrorAttribution(syncBlockInstance.error.type || syncBlockInstance.error.reason, syncBlockInstance.error.statusCode)));
|
|
648
641
|
}
|
|
649
642
|
if (syncBlockInstance.error.type === SyncBlockError.NotFound || syncBlockInstance.error.type === SyncBlockError.Forbidden) {
|
|
650
643
|
hasExpectedError = true;
|
|
@@ -652,9 +645,7 @@ export var ReferenceSyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
652
645
|
// Schedule a retry for EntityNotFound — the source block may be in
|
|
653
646
|
// the process of being created by a collaborator (race condition
|
|
654
647
|
// between NCS propagation and Block Service createBlock call).
|
|
655
|
-
|
|
656
|
-
_this5.scheduleEntityNotFoundRetry(syncBlockInstance.resourceId);
|
|
657
|
-
}
|
|
648
|
+
_this5.scheduleEntityNotFoundRetry(syncBlockInstance.resourceId);
|
|
658
649
|
if (!isRetryingEntityNotFound) {
|
|
659
650
|
hasUnexpectedError = true;
|
|
660
651
|
}
|
|
@@ -682,7 +673,7 @@ export var ReferenceSyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
682
673
|
var existingSyncBlock = this.getFromCache(resourceId);
|
|
683
674
|
// If the cache entry was deleted while the source-info request was
|
|
684
675
|
// in flight, fire an analytics event so the race is observable.
|
|
685
|
-
if (!existingSyncBlock
|
|
676
|
+
if (!existingSyncBlock) {
|
|
686
677
|
var _this$fireAnalyticsEv5;
|
|
687
678
|
(_this$fireAnalyticsEv5 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv5 === void 0 || _this$fireAnalyticsEv5.call(this, sourceInfoOrphanedPayload(resourceId, getSourceProductFromResourceIdSafe(resourceId), {
|
|
688
679
|
hasPendingDeletion: this.pendingCacheDeletions.has(resourceId),
|
|
@@ -735,16 +726,14 @@ export var ReferenceSyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
735
726
|
this._providerFactoryManager.deleteFactory(resourceId);
|
|
736
727
|
// Evict in-flight source-info promise and reset reschedule counter
|
|
737
728
|
// so a stale resolution can't silently merge into a re-fetched entry.
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
this.cacheDeletionRescheduleCounts.delete(resourceId);
|
|
741
|
-
}
|
|
729
|
+
this.syncBlockSourceInfoRequests.delete(resourceId);
|
|
730
|
+
this.cacheDeletionRescheduleCounts.delete(resourceId);
|
|
742
731
|
}
|
|
743
732
|
|
|
744
733
|
/**
|
|
745
734
|
* Returns true if the cache entry for `resourceId` is safe to delete:
|
|
746
735
|
* no active subscribers, no in-flight source-info request, and no
|
|
747
|
-
* queued/in-flight batch fetch
|
|
736
|
+
* queued/in-flight batch fetch.
|
|
748
737
|
*/
|
|
749
738
|
}, {
|
|
750
739
|
key: "canDeleteCache",
|
|
@@ -763,7 +752,7 @@ export var ReferenceSyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
763
752
|
|
|
764
753
|
/**
|
|
765
754
|
* Schedules cache deletion for `resourceId` after the grace period
|
|
766
|
-
*
|
|
755
|
+
* Called when the last
|
|
767
756
|
* subscriber unsubscribes. Guards are re-checked at fire time; if any
|
|
768
757
|
* are positive the timer is rescheduled up to MAX_RESCHEDULES times.
|
|
769
758
|
*/
|
|
@@ -771,9 +760,6 @@ export var ReferenceSyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
771
760
|
key: "scheduleCacheDeletion",
|
|
772
761
|
value: function scheduleCacheDeletion(resourceId) {
|
|
773
762
|
var _this6 = this;
|
|
774
|
-
if (!fg('platform_synced_block_patch_14')) {
|
|
775
|
-
return;
|
|
776
|
-
}
|
|
777
763
|
if (this.isDestroyed) {
|
|
778
764
|
return;
|
|
779
765
|
}
|
|
@@ -801,15 +787,12 @@ export var ReferenceSyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
801
787
|
|
|
802
788
|
/**
|
|
803
789
|
* Cancels any pending cache deletion timer for `resourceId` and resets the
|
|
804
|
-
* reschedule counter
|
|
790
|
+
* reschedule counter. Called
|
|
805
791
|
* when a new subscriber arrives.
|
|
806
792
|
*/
|
|
807
793
|
}, {
|
|
808
794
|
key: "cancelPendingCacheDeletion",
|
|
809
795
|
value: function cancelPendingCacheDeletion(resourceId) {
|
|
810
|
-
if (!fg('platform_synced_block_patch_14')) {
|
|
811
|
-
return;
|
|
812
|
-
}
|
|
813
796
|
var existing = this.pendingCacheDeletions.get(resourceId);
|
|
814
797
|
if (existing) {
|
|
815
798
|
clearTimeout(existing);
|
|
@@ -961,14 +944,14 @@ export var ReferenceSyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
961
944
|
var _this$fireAnalyticsEv7;
|
|
962
945
|
// EDITOR-7860: benign not-ready/torn-down case — suppress both the
|
|
963
946
|
// exception-tracker log and the analytics event (checked first so the
|
|
964
|
-
// benign case stays fully silent).
|
|
965
|
-
if (isProviderNotReadyError(error)
|
|
947
|
+
// benign case stays fully silent).
|
|
948
|
+
if (isProviderNotReadyError(error)) {
|
|
966
949
|
return function () {};
|
|
967
950
|
}
|
|
968
951
|
logException(error, {
|
|
969
952
|
location: 'editor-synced-block-provider/referenceSyncBlockStoreManager'
|
|
970
953
|
});
|
|
971
|
-
(_this$fireAnalyticsEv7 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv7 === void 0 || _this$fireAnalyticsEv7.call(this, fetchErrorPayload(error.message, undefined, undefined, buildFetchErrorAttribution(
|
|
954
|
+
(_this$fireAnalyticsEv7 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv7 === void 0 || _this$fireAnalyticsEv7.call(this, fetchErrorPayload(error.message, undefined, undefined, buildFetchErrorAttribution(error.message)));
|
|
972
955
|
return function () {};
|
|
973
956
|
}
|
|
974
957
|
}
|
|
@@ -1131,7 +1114,7 @@ export var ReferenceSyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
1131
1114
|
(_this$saveExperience2 = this.saveExperience) === null || _this$saveExperience2 === void 0 || _this$saveExperience2.failure({
|
|
1132
1115
|
reason: updateResult.error || 'Failed to update reference synced blocks on the document'
|
|
1133
1116
|
});
|
|
1134
|
-
(_this$fireAnalyticsEv8 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv8 === void 0 || _this$fireAnalyticsEv8.call(this, updateReferenceErrorPayload(updateResult.error || 'Failed to update reference synced blocks on the document', undefined, undefined, buildErrorAttribution(
|
|
1117
|
+
(_this$fireAnalyticsEv8 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv8 === void 0 || _this$fireAnalyticsEv8.call(this, updateReferenceErrorPayload(updateResult.error || 'Failed to update reference synced blocks on the document', undefined, undefined, buildErrorAttribution(updateResult.error, updateResult.statusCode)));
|
|
1135
1118
|
}
|
|
1136
1119
|
_context4.next = 17;
|
|
1137
1120
|
break;
|
|
@@ -1148,7 +1131,7 @@ export var ReferenceSyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
1148
1131
|
// No `resourceId` available in this catch — sourceProduct is intentionally omitted.
|
|
1149
1132
|
// No structured SyncBlockError/status here, so the attribution `reason` falls back
|
|
1150
1133
|
// to `unknown` when the gate is on.
|
|
1151
|
-
(_this$fireAnalyticsEv9 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv9 === void 0 || _this$fireAnalyticsEv9.call(this, updateReferenceErrorPayload(_t3.message, undefined, undefined, buildErrorAttribution(
|
|
1134
|
+
(_this$fireAnalyticsEv9 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv9 === void 0 || _this$fireAnalyticsEv9.call(this, updateReferenceErrorPayload(_t3.message, undefined, undefined, buildErrorAttribution()));
|
|
1152
1135
|
case 17:
|
|
1153
1136
|
_context4.prev = 17;
|
|
1154
1137
|
if (!success) {
|
|
@@ -1230,17 +1213,9 @@ export var ReferenceSyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
1230
1213
|
});
|
|
1231
1214
|
this.fireAnalyticsEvent = undefined;
|
|
1232
1215
|
|
|
1233
|
-
//
|
|
1234
|
-
//
|
|
1235
|
-
//
|
|
1236
|
-
// cache data that a sibling/successor manager (e.g. the editor
|
|
1237
|
-
// instance that mounts immediately after the renderer unmounts during
|
|
1238
|
-
// the view-mode transition) is about to read.
|
|
1239
|
-
// Let entries age out naturally instead — the in-memory cache is
|
|
1240
|
-
// naturally bounded by `maxSize` (LRU) and cleared on hard navigation.
|
|
1241
|
-
if (!fg('platform_synced_block_patch_14')) {
|
|
1242
|
-
syncBlockInMemorySessionCache.clear();
|
|
1243
|
-
}
|
|
1216
|
+
// `destroy()` is wired to React component unmount via
|
|
1217
|
+
// `useMemoizedSyncBlockStoreManager`. Let the in-memory session cache age
|
|
1218
|
+
// out naturally instead of clearing it during a view-mode transition.
|
|
1244
1219
|
}
|
|
1245
1220
|
}]);
|
|
1246
1221
|
}();
|
|
@@ -10,7 +10,6 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
|
|
|
10
10
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
11
11
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
12
12
|
import { logException } from '@atlaskit/editor-common/monitoring';
|
|
13
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
13
|
import { SyncBlockError } from '../common/types';
|
|
15
14
|
import { updateErrorPayload, createErrorPayload, deleteErrorPayload, updateCacheErrorPayload, getSourceInfoErrorPayload, updateSuccessPayload, createSuccessPayload, createSuccessOperationalPayload, addContentSuccessPayload, deleteSuccessPayload, fetchReferencesErrorPayload, buildErrorAttribution } from '../utils/errorHandling';
|
|
16
15
|
import { getCreateSourceExperience, getDeleteSourceExperience, getSaveSourceExperience, getFetchSourceInfoExperience } from '../utils/experienceTracking';
|
|
@@ -75,8 +74,7 @@ export var SourceSyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
75
74
|
_defineProperty(this, "awaitingFirstContent", new Set());
|
|
76
75
|
/**
|
|
77
76
|
* resourceId -> timestamp (ms) of the last `syncedBlockDelete` emission, used
|
|
78
|
-
* to suppress duplicates within {@link DELETE_DEDUPE_WINDOW_MS}.
|
|
79
|
-
* behind `platform_editor_blocks_patch_4`.
|
|
77
|
+
* to suppress duplicates within {@link DELETE_DEDUPE_WINDOW_MS}.
|
|
80
78
|
*/
|
|
81
79
|
_defineProperty(this, "recentDeleteEmissions", new Map());
|
|
82
80
|
_defineProperty(this, "setPendingDeletion", function (Ids, value) {
|
|
@@ -162,10 +160,7 @@ export var SourceSyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
162
160
|
resourceId = _syncBlockNode$attrs.resourceId;
|
|
163
161
|
if (!localId || !resourceId) {
|
|
164
162
|
// Identifiers not populated yet: benign timing case, skip as a no-op.
|
|
165
|
-
|
|
166
|
-
return false;
|
|
167
|
-
}
|
|
168
|
-
throw new Error('Local ID or resource ID is not set');
|
|
163
|
+
return false;
|
|
169
164
|
}
|
|
170
165
|
var cachedBlock = this.syncBlockCache.get(resourceId);
|
|
171
166
|
|
|
@@ -208,7 +203,7 @@ export var SourceSyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
208
203
|
value: (function () {
|
|
209
204
|
var _flush = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
210
205
|
var _this2 = this;
|
|
211
|
-
var _this$saveExperience, timedOut, timeoutId, timeout, _iterator, _step, resourceId, bodiedSyncBlockNodes, bodiedSyncBlockData, writeResults, _this$saveExperience2, _this$saveExperience3,
|
|
206
|
+
var _this$saveExperience, timedOut, timeoutId, timeout, _iterator, _step, resourceId, bodiedSyncBlockNodes, bodiedSyncBlockData, writeResults, _this$saveExperience2, _this$saveExperience3, _this$fireAnalyticsEv2, _this$flushCompletion, _t;
|
|
212
207
|
return _regeneratorRuntime.wrap(function (_context) {
|
|
213
208
|
while (1) switch (_context.prev = _context.next) {
|
|
214
209
|
case 0:
|
|
@@ -327,12 +322,11 @@ export var SourceSyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
327
322
|
return _context.abrupt("return", true);
|
|
328
323
|
case 7:
|
|
329
324
|
(_this$saveExperience3 = this.saveExperience) === null || _this$saveExperience3 === void 0 || _this$saveExperience3.failure();
|
|
330
|
-
attributionEnabled = fg('platform_editor_blocks_patch_3');
|
|
331
325
|
writeResults.filter(function (result) {
|
|
332
326
|
return !result.resourceId || result.error;
|
|
333
327
|
}).forEach(function (result) {
|
|
334
328
|
var _this2$fireAnalyticsE2;
|
|
335
|
-
(_this2$fireAnalyticsE2 = _this2.fireAnalyticsEvent) === null || _this2$fireAnalyticsE2 === void 0 || _this2$fireAnalyticsE2.call(_this2, updateErrorPayload(result.error || 'Failed to write data', result.resourceId, getSourceProductFromResourceIdSafe(result.resourceId), buildErrorAttribution(
|
|
329
|
+
(_this2$fireAnalyticsE2 = _this2.fireAnalyticsEvent) === null || _this2$fireAnalyticsE2 === void 0 || _this2$fireAnalyticsE2.call(_this2, updateErrorPayload(result.error || 'Failed to write data', result.resourceId, getSourceProductFromResourceIdSafe(result.resourceId), buildErrorAttribution(result.error, result.statusCode)));
|
|
336
330
|
});
|
|
337
331
|
return _context.abrupt("return", false);
|
|
338
332
|
case 8:
|
|
@@ -346,7 +340,7 @@ export var SourceSyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
346
340
|
});
|
|
347
341
|
// Top-level flush failure is not tied to a single resourceId. There is no structured
|
|
348
342
|
// SyncBlockError/status here, so the attribution `reason` falls back to `unknown`.
|
|
349
|
-
(_this$fireAnalyticsEv2 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv2 === void 0 || _this$fireAnalyticsEv2.call(this, updateErrorPayload(_t.message, undefined, undefined, buildErrorAttribution(
|
|
343
|
+
(_this$fireAnalyticsEv2 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv2 === void 0 || _this$fireAnalyticsEv2.call(this, updateErrorPayload(_t.message, undefined, undefined, buildErrorAttribution()));
|
|
350
344
|
return _context.abrupt("return", false);
|
|
351
345
|
case 10:
|
|
352
346
|
_context.prev = 10;
|
|
@@ -440,15 +434,12 @@ export var SourceSyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
440
434
|
(_this$fireAnalyticsEv3 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv3 === void 0 || _this$fireAnalyticsEv3.call(this, createErrorPayload('creation complete callback missing', resourceId, getSourceProductFromResourceIdSafe(resourceId)));
|
|
441
435
|
}
|
|
442
436
|
if (success) {
|
|
443
|
-
var _this$fireAnalyticsEv4;
|
|
437
|
+
var _this$fireAnalyticsEv4, _this$fireAnalyticsEv5, _this$syncBlockCache$2;
|
|
444
438
|
var sourceProduct = getSourceProductFromResourceIdSafe(resourceId);
|
|
445
439
|
(_this$fireAnalyticsEv4 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv4 === void 0 || _this$fireAnalyticsEv4.call(this, createSuccessPayload(resourceId || '', sourceProduct));
|
|
446
440
|
// Operational create-success event with the join key + creation-type
|
|
447
441
|
// signals (inputMethod / createdEmpty) captured at the command layer.
|
|
448
|
-
|
|
449
|
-
var _this$fireAnalyticsEv5, _this$syncBlockCache$2;
|
|
450
|
-
(_this$fireAnalyticsEv5 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv5 === void 0 || _this$fireAnalyticsEv5.call(this, 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)));
|
|
451
|
-
}
|
|
442
|
+
(_this$fireAnalyticsEv5 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv5 === void 0 || _this$fireAnalyticsEv5.call(this, 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)));
|
|
452
443
|
} else {
|
|
453
444
|
var _this$fireAnalyticsEv6;
|
|
454
445
|
// Delete the node from cache if fail to create so it's not flushed to BE
|
|
@@ -467,7 +458,6 @@ export var SourceSyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
467
458
|
* Fire the first-content-added event once when a block created empty this
|
|
468
459
|
* session first gains content. The caller detects the in-block edit; this owns
|
|
469
460
|
* dedupe + emission (fires at most once per block, only for empty→content).
|
|
470
|
-
* Gated behind `platform_editor_blocks_patch_4`.
|
|
471
461
|
*/
|
|
472
462
|
}, {
|
|
473
463
|
key: "maybeEmitFirstContentAdded",
|
|
@@ -476,9 +466,6 @@ export var SourceSyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
476
466
|
if (this.viewMode === 'view') {
|
|
477
467
|
return;
|
|
478
468
|
}
|
|
479
|
-
if (!fg('platform_editor_blocks_patch_4')) {
|
|
480
|
-
return;
|
|
481
|
-
}
|
|
482
469
|
// `delete` returns false when the id was not tracked (already emitted, or
|
|
483
470
|
// the block was not created empty this session), so this both dedupes and
|
|
484
471
|
// scopes emission to genuine first-content transitions in one check.
|
|
@@ -582,7 +569,7 @@ export var SourceSyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
582
569
|
(_this4$createExperien2 = _this4.createExperience) === null || _this4$createExperien2 === void 0 || _this4$createExperien2.failure({
|
|
583
570
|
reason: result.error || 'Failed to create bodied sync block'
|
|
584
571
|
});
|
|
585
|
-
(_this4$fireAnalyticsE = _this4.fireAnalyticsEvent) === null || _this4$fireAnalyticsE === void 0 || _this4$fireAnalyticsE.call(_this4, createErrorPayload(result.error || 'Failed to create bodied sync block', resourceId, getSourceProductFromResourceIdSafe(resourceId), buildErrorAttribution(
|
|
572
|
+
(_this4$fireAnalyticsE = _this4.fireAnalyticsEvent) === null || _this4$fireAnalyticsE === void 0 || _this4$fireAnalyticsE.call(_this4, createErrorPayload(result.error || 'Failed to create bodied sync block', resourceId, getSourceProductFromResourceIdSafe(resourceId), buildErrorAttribution(result.error, result.statusCode)));
|
|
586
573
|
}
|
|
587
574
|
}).catch(function (error) {
|
|
588
575
|
var _this4$createExperien3, _this4$fireAnalyticsE2;
|
|
@@ -645,13 +632,8 @@ export var SourceSyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
645
632
|
}, {
|
|
646
633
|
key: "emitDeleteSuccess",
|
|
647
634
|
value: function emitDeleteSuccess(resourceId, reason, mechanism) {
|
|
648
|
-
var _this$syncBlockCache$3, _this$
|
|
635
|
+
var _this$syncBlockCache$3, _this$fireAnalyticsEv9;
|
|
649
636
|
var sourceProduct = getSourceProductFromResourceIdSafe(resourceId);
|
|
650
|
-
if (!fg('platform_editor_blocks_patch_4')) {
|
|
651
|
-
var _this$fireAnalyticsEv9;
|
|
652
|
-
(_this$fireAnalyticsEv9 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv9 === void 0 || _this$fireAnalyticsEv9.call(this, deleteSuccessPayload(resourceId, sourceProduct));
|
|
653
|
-
return;
|
|
654
|
-
}
|
|
655
637
|
var now = Date.now();
|
|
656
638
|
var lastEmittedAt = this.recentDeleteEmissions.get(resourceId);
|
|
657
639
|
if (lastEmittedAt !== undefined && now - lastEmittedAt < DELETE_DEDUPE_WINDOW_MS) {
|
|
@@ -664,14 +646,14 @@ export var SourceSyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
664
646
|
deletionReason: reason,
|
|
665
647
|
mechanism: mechanism
|
|
666
648
|
};
|
|
667
|
-
(_this$
|
|
649
|
+
(_this$fireAnalyticsEv9 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv9 === void 0 || _this$fireAnalyticsEv9.call(this, deleteSuccessPayload(resourceId, sourceProduct, enrichment));
|
|
668
650
|
}
|
|
669
651
|
}, {
|
|
670
652
|
key: "delete",
|
|
671
653
|
value: function () {
|
|
672
654
|
var _delete2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(syncBlockIds, onDelete, onDeleteCompleted, reason, mechanism) {
|
|
673
655
|
var _this5 = this;
|
|
674
|
-
var _this$deleteExperienc, results, callback, isDeleteSuccessful, _this$deleteExperienc2, _this$deleteExperienc3,
|
|
656
|
+
var _this$deleteExperienc, results, callback, isDeleteSuccessful, _this$deleteExperienc2, _this$deleteExperienc3, attribution, _t2;
|
|
675
657
|
return _regeneratorRuntime.wrap(function (_context2) {
|
|
676
658
|
while (1) switch (_context2.prev = _context2.next) {
|
|
677
659
|
case 0:
|
|
@@ -719,13 +701,12 @@ export var SourceSyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
719
701
|
_this5.setPendingDeletion(Ids, false);
|
|
720
702
|
};
|
|
721
703
|
(_this$deleteExperienc3 = this.deleteExperience) === null || _this$deleteExperienc3 === void 0 || _this$deleteExperienc3.failure();
|
|
722
|
-
attributionEnabled = fg('platform_editor_blocks_patch_3');
|
|
723
704
|
results.forEach(function (result) {
|
|
724
705
|
if (result.success) {
|
|
725
706
|
_this5.emitDeleteSuccess(result.resourceId, reason, mechanism);
|
|
726
707
|
} else {
|
|
727
708
|
var _this5$fireAnalyticsE;
|
|
728
|
-
(_this5$fireAnalyticsE = _this5.fireAnalyticsEvent) === null || _this5$fireAnalyticsE === void 0 || _this5$fireAnalyticsE.call(_this5, deleteErrorPayload(result.error || 'Failed to delete synced block', result.resourceId, getSourceProductFromResourceIdSafe(result.resourceId), buildErrorAttribution(
|
|
709
|
+
(_this5$fireAnalyticsE = _this5.fireAnalyticsEvent) === null || _this5$fireAnalyticsE === void 0 || _this5$fireAnalyticsE.call(_this5, deleteErrorPayload(result.error || 'Failed to delete synced block', result.resourceId, getSourceProductFromResourceIdSafe(result.resourceId), buildErrorAttribution(result.error, result.statusCode)));
|
|
729
710
|
}
|
|
730
711
|
});
|
|
731
712
|
}
|
|
@@ -736,7 +717,7 @@ export var SourceSyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
736
717
|
_t2 = _context2["catch"](0);
|
|
737
718
|
// Thrown (non-result) failure — no structured SyncBlockError/status is available,
|
|
738
719
|
// so the attribution `reason` falls back to `unknown` when the gate is on.
|
|
739
|
-
attribution = buildErrorAttribution(
|
|
720
|
+
attribution = buildErrorAttribution();
|
|
740
721
|
syncBlockIds.forEach(function (Ids) {
|
|
741
722
|
var _this5$fireAnalyticsE2;
|
|
742
723
|
_this5.setPendingDeletion(Ids, false);
|
|
@@ -1013,11 +994,11 @@ export var SourceSyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
1013
994
|
return sourceInfo;
|
|
1014
995
|
});
|
|
1015
996
|
} catch (error) {
|
|
1016
|
-
var _this$
|
|
997
|
+
var _this$fireAnalyticsEv0;
|
|
1017
998
|
logException(error, {
|
|
1018
999
|
location: 'editor-synced-block-provider/sourceSyncBlockStoreManager'
|
|
1019
1000
|
});
|
|
1020
|
-
(_this$
|
|
1001
|
+
(_this$fireAnalyticsEv0 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv0 === void 0 || _this$fireAnalyticsEv0.call(this, getSourceInfoErrorPayload(error.message));
|
|
1021
1002
|
return Promise.resolve(undefined);
|
|
1022
1003
|
}
|
|
1023
1004
|
}
|
|
@@ -1030,11 +1011,11 @@ export var SourceSyncBlockStoreManager = /*#__PURE__*/function () {
|
|
|
1030
1011
|
}
|
|
1031
1012
|
return this.dataProvider.fetchReferences(resourceId, true);
|
|
1032
1013
|
} catch (error) {
|
|
1033
|
-
var _this$
|
|
1014
|
+
var _this$fireAnalyticsEv1;
|
|
1034
1015
|
logException(error, {
|
|
1035
1016
|
location: 'editor-synced-block-provider/sourceSyncBlockStoreManager'
|
|
1036
1017
|
});
|
|
1037
|
-
(_this$
|
|
1018
|
+
(_this$fireAnalyticsEv1 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv1 === void 0 || _this$fireAnalyticsEv1.call(this, fetchReferencesErrorPayload(error.message, resourceId, getSourceProductFromResourceIdSafe(resourceId)));
|
|
1038
1019
|
return Promise.resolve({
|
|
1039
1020
|
error: SyncBlockError.Errored
|
|
1040
1021
|
});
|
|
@@ -3,7 +3,6 @@ import _createClass from "@babel/runtime/helpers/createClass";
|
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
4
|
import rafSchedule from 'raf-schd';
|
|
5
5
|
import { logException } from '@atlaskit/editor-common/monitoring';
|
|
6
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
6
|
import { isProviderNotReadyError } from '../common/types';
|
|
8
7
|
import { buildFetchErrorAttribution, fetchErrorPayload } from '../utils/errorHandling';
|
|
9
8
|
import { createSyncBlockNode, getSourceProductFromResourceIdSafe } from '../utils/utils';
|
|
@@ -29,14 +28,9 @@ export var SyncBlockBatchFetcher = /*#__PURE__*/function () {
|
|
|
29
28
|
}
|
|
30
29
|
|
|
31
30
|
// EDITOR-7860: not ready — skip and leave resourceIds queued for the
|
|
32
|
-
// next batch once the provider resolves.
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
// exposure is still tracked — satisfies @atlaskit/platform/no-preconditioning).
|
|
36
|
-
if (fg('platform_editor_blocks_patch_3')) {
|
|
37
|
-
if (_this.deps.isProviderReady && !_this.deps.isProviderReady()) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
31
|
+
// next batch once the provider resolves.
|
|
32
|
+
if (_this.deps.isProviderReady && !_this.deps.isProviderReady()) {
|
|
33
|
+
return;
|
|
40
34
|
}
|
|
41
35
|
var resourceIds = Array.from(_this.pendingFetchRequests);
|
|
42
36
|
var syncBlockNodes = resourceIds.map(function (resId) {
|
|
@@ -55,8 +49,8 @@ export var SyncBlockBatchFetcher = /*#__PURE__*/function () {
|
|
|
55
49
|
// nothing (no analytics, no exception-tracker noise). Checked before
|
|
56
50
|
// `logException` so the benign case stays silent. Re-schedule so the
|
|
57
51
|
// re-queued IDs are retried on the next frame even if no further
|
|
58
|
-
// `queueFetch()` arrives.
|
|
59
|
-
if (isProviderNotReadyError(error)
|
|
52
|
+
// `queueFetch()` arrives.
|
|
53
|
+
if (isProviderNotReadyError(error)) {
|
|
60
54
|
resourceIds.forEach(function (resId) {
|
|
61
55
|
return _this.pendingFetchRequests.add(resId);
|
|
62
56
|
});
|
|
@@ -68,7 +62,7 @@ export var SyncBlockBatchFetcher = /*#__PURE__*/function () {
|
|
|
68
62
|
logException(error, {
|
|
69
63
|
location: 'editor-synced-block-provider/syncBlockBatchFetcher/batchedFetchSyncBlocks'
|
|
70
64
|
});
|
|
71
|
-
var attribution = buildFetchErrorAttribution(
|
|
65
|
+
var attribution = buildFetchErrorAttribution(error.message);
|
|
72
66
|
resourceIds.forEach(function (resId) {
|
|
73
67
|
var _this$deps$getFireAna;
|
|
74
68
|
(_this$deps$getFireAna = _this.deps.getFireAnalyticsEvent()) === null || _this$deps$getFireAna === void 0 || _this$deps$getFireAna(fetchErrorPayload(error.message, resId, getSourceProductFromResourceIdSafe(resId), attribution));
|
|
@@ -28,7 +28,7 @@ export var SyncBlockProviderFactoryManager = /*#__PURE__*/function () {
|
|
|
28
28
|
logException(error, {
|
|
29
29
|
location: 'editor-synced-block-provider/syncBlockProviderFactoryManager'
|
|
30
30
|
});
|
|
31
|
-
(_this$deps$getFireAna = this.deps.getFireAnalyticsEvent()) === null || _this$deps$getFireAna === void 0 || _this$deps$getFireAna(fetchErrorPayload(error.message, resourceId, getSourceProductFromResourceIdSafe(resourceId), buildFetchErrorAttribution(
|
|
31
|
+
(_this$deps$getFireAna = this.deps.getFireAnalyticsEvent()) === null || _this$deps$getFireAna === void 0 || _this$deps$getFireAna(fetchErrorPayload(error.message, resourceId, getSourceProductFromResourceIdSafe(resourceId), buildFetchErrorAttribution(error.message)));
|
|
32
32
|
return undefined;
|
|
33
33
|
}
|
|
34
34
|
var providerFactory = this.providerFactories.get(resourceId);
|
|
@@ -104,7 +104,7 @@ export var SyncBlockProviderFactoryManager = /*#__PURE__*/function () {
|
|
|
104
104
|
logException(error, {
|
|
105
105
|
location: 'editor-synced-block-provider/syncBlockProviderFactoryManager'
|
|
106
106
|
});
|
|
107
|
-
(_this$deps$getFireAna2 = this.deps.getFireAnalyticsEvent()) === null || _this$deps$getFireAna2 === void 0 || _this$deps$getFireAna2(fetchErrorPayload(error.message, resourceId, getSourceProductFromResourceIdSafe(resourceId), buildFetchErrorAttribution(
|
|
107
|
+
(_this$deps$getFireAna2 = this.deps.getFireAnalyticsEvent()) === null || _this$deps$getFireAna2 === void 0 || _this$deps$getFireAna2(fetchErrorPayload(error.message, resourceId, getSourceProductFromResourceIdSafe(resourceId), buildFetchErrorAttribution(error.message)));
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
}, {
|
|
@@ -187,7 +187,7 @@ export var SyncBlockProviderFactoryManager = /*#__PURE__*/function () {
|
|
|
187
187
|
if (!syncBlock.data.sourceAri || !syncBlock.data.product) {
|
|
188
188
|
var _this$deps$getFireAna3, _syncBlock$data$produ;
|
|
189
189
|
(_this$deps$getFireAna3 = this.deps.getFireAnalyticsEvent()) === null || _this$deps$getFireAna3 === void 0 || _this$deps$getFireAna3(fetchErrorPayload('Sync block source ari or product not found', resourceId, // Prefer cached product when available; fall back to parsing resourceId.
|
|
190
|
-
(_syncBlock$data$produ = syncBlock.data.product) !== null && _syncBlock$data$produ !== void 0 ? _syncBlock$data$produ : getSourceProductFromResourceIdSafe(resourceId), buildFetchErrorAttribution(
|
|
190
|
+
(_syncBlock$data$produ = syncBlock.data.product) !== null && _syncBlock$data$produ !== void 0 ? _syncBlock$data$produ : getSourceProductFromResourceIdSafe(resourceId), buildFetchErrorAttribution('Sync block source ari or product not found')));
|
|
191
191
|
return;
|
|
192
192
|
}
|
|
193
193
|
var parentInfo = dataProvider.retrieveSyncBlockParentInfo(syncBlock.data.sourceAri, syncBlock.data.product);
|
|
@@ -7,7 +7,6 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
7
7
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
8
8
|
import { useEffect, useMemo, useRef } from 'react';
|
|
9
9
|
import { logException } from '@atlaskit/editor-common/monitoring';
|
|
10
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
10
|
import { getProductFromSourceAri } from '../clients/block-service/ari';
|
|
12
11
|
import { SyncBlockError } from '../common/types';
|
|
13
12
|
import { fetchReferencesErrorPayload } from '../utils/errorHandling';
|
|
@@ -303,7 +302,6 @@ export var useMemoizedSyncBlockStoreManager = function useMemoizedSyncBlockStore
|
|
|
303
302
|
syncBlockStoreManager.setFireAnalyticsEvent(fireAnalyticsEvent);
|
|
304
303
|
}
|
|
305
304
|
|
|
306
|
-
// Gated by platform_synced_block_patch_14:
|
|
307
305
|
// Destroy the SyncBlockStoreManager when:
|
|
308
306
|
// (a) the component unmounts — manager is fully cleaned up, or
|
|
309
307
|
// (b) dataProvider changes — the old manager (now orphaned by the
|
|
@@ -315,9 +313,7 @@ export var useMemoizedSyncBlockStoreManager = function useMemoizedSyncBlockStore
|
|
|
315
313
|
// changes, triggering the cleanup for the old instance.
|
|
316
314
|
useEffect(function () {
|
|
317
315
|
return function () {
|
|
318
|
-
|
|
319
|
-
syncBlockStoreManager.destroy();
|
|
320
|
-
}
|
|
316
|
+
syncBlockStoreManager.destroy();
|
|
321
317
|
};
|
|
322
318
|
}, [syncBlockStoreManager]);
|
|
323
319
|
return syncBlockStoreManager;
|