@atlaskit/editor-synced-block-provider 3.26.0 → 3.26.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/cjs/clients/block-service/blockService.js +9 -14
- package/dist/cjs/clients/confluence/sourceInfo.js +3 -35
- package/dist/cjs/hooks/useFetchSyncBlockData.js +5 -11
- package/dist/cjs/providers/block-service/blockServiceAPI.js +1 -1
- package/dist/cjs/providers/syncBlockProvider.js +29 -72
- package/dist/cjs/store-manager/referenceSyncBlockStoreManager.js +75 -124
- package/dist/cjs/store-manager/sourceSyncBlockStoreManager.js +125 -120
- package/dist/cjs/store-manager/syncBlockStoreManager.js +2 -4
- package/dist/cjs/utils/errorHandling.js +2 -5
- package/dist/cjs/utils/resolveSyncBlockInstance.js +1 -3
- package/dist/cjs/utils/utils.js +5 -6
- package/dist/es2019/clients/block-service/blockService.js +5 -9
- package/dist/es2019/clients/confluence/sourceInfo.js +1 -4
- package/dist/es2019/hooks/useFetchSyncBlockData.js +6 -12
- package/dist/es2019/providers/block-service/blockServiceAPI.js +1 -1
- package/dist/es2019/providers/syncBlockProvider.js +21 -53
- package/dist/es2019/store-manager/referenceSyncBlockStoreManager.js +65 -114
- package/dist/es2019/store-manager/sourceSyncBlockStoreManager.js +125 -119
- package/dist/es2019/store-manager/syncBlockStoreManager.js +2 -4
- package/dist/es2019/utils/errorHandling.js +1 -4
- package/dist/es2019/utils/resolveSyncBlockInstance.js +2 -5
- package/dist/es2019/utils/utils.js +5 -6
- package/dist/esm/clients/block-service/blockService.js +9 -14
- package/dist/esm/clients/confluence/sourceInfo.js +2 -34
- package/dist/esm/hooks/useFetchSyncBlockData.js +5 -11
- package/dist/esm/providers/block-service/blockServiceAPI.js +1 -1
- package/dist/esm/providers/syncBlockProvider.js +29 -72
- package/dist/esm/store-manager/referenceSyncBlockStoreManager.js +75 -124
- package/dist/esm/store-manager/sourceSyncBlockStoreManager.js +125 -120
- package/dist/esm/store-manager/syncBlockStoreManager.js +2 -4
- package/dist/esm/utils/errorHandling.js +2 -5
- package/dist/esm/utils/resolveSyncBlockInstance.js +1 -3
- package/dist/esm/utils/utils.js +5 -6
- package/dist/types/clients/confluence/sourceInfo.d.ts +1 -2
- package/dist/types/hooks/useFetchSyncBlockData.d.ts +1 -1
- package/dist/types/providers/syncBlockProvider.d.ts +1 -1
- package/dist/types/providers/types.d.ts +2 -2
- package/dist/types/store-manager/sourceSyncBlockStoreManager.d.ts +8 -5
- package/dist/types-ts4.5/clients/confluence/sourceInfo.d.ts +1 -2
- package/dist/types-ts4.5/hooks/useFetchSyncBlockData.d.ts +1 -1
- package/dist/types-ts4.5/providers/syncBlockProvider.d.ts +1 -1
- package/dist/types-ts4.5/providers/types.d.ts +2 -2
- package/dist/types-ts4.5/store-manager/sourceSyncBlockStoreManager.d.ts +8 -5
- package/package.json +2 -5
|
@@ -215,7 +215,7 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
215
215
|
value: function getInitialSyncBlockData(resourceId) {
|
|
216
216
|
var _this$dataProvider2;
|
|
217
217
|
var syncBlockNode = (0, _utils.createSyncBlockNode)('', resourceId);
|
|
218
|
-
if ((0, _coreUtils.isSSR)()
|
|
218
|
+
if ((0, _coreUtils.isSSR)() || (0, _platformFeatureFlags.fg)('platform_synced_block_patch_1')) {
|
|
219
219
|
var _this$dataProvider;
|
|
220
220
|
// In SSR, prefer data from data provider cache
|
|
221
221
|
// should not take from store manager cache as it may be in incomplete state
|
|
@@ -458,17 +458,13 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
458
458
|
value: function fetchSyncBlockSourceInfo(resourceId) {
|
|
459
459
|
var _this6 = this;
|
|
460
460
|
try {
|
|
461
|
-
var _existingSyncBlock$da;
|
|
461
|
+
var _this$fetchSourceInfo, _existingSyncBlock$da;
|
|
462
462
|
if (!resourceId || !this.dataProvider) {
|
|
463
463
|
throw new Error('Data provider or resourceId not set');
|
|
464
464
|
}
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
return existingRequest;
|
|
469
|
-
}
|
|
470
|
-
} else if (this.syncBlockSourceInfoRequestsOld.get(resourceId)) {
|
|
471
|
-
return Promise.resolve(undefined);
|
|
465
|
+
var existingRequest = this.syncBlockSourceInfoRequests.get(resourceId);
|
|
466
|
+
if (existingRequest) {
|
|
467
|
+
return existingRequest;
|
|
472
468
|
}
|
|
473
469
|
var existingSyncBlock = this.getFromCache(resourceId);
|
|
474
470
|
if (!existingSyncBlock) {
|
|
@@ -484,28 +480,21 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
484
480
|
sourceSubType = _ref.sourceSubType;
|
|
485
481
|
// skip if source URL and title are already present
|
|
486
482
|
if (sourceURL && sourceTitle) {
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
});
|
|
496
|
-
} else {
|
|
497
|
-
return Promise.resolve(undefined);
|
|
498
|
-
}
|
|
483
|
+
return Promise.resolve({
|
|
484
|
+
title: sourceTitle,
|
|
485
|
+
url: sourceURL,
|
|
486
|
+
subType: sourceSubType,
|
|
487
|
+
sourceAri: sourceAri || '',
|
|
488
|
+
onSameDocument: onSameDocument,
|
|
489
|
+
productType: product
|
|
490
|
+
});
|
|
499
491
|
}
|
|
500
492
|
if (!sourceAri || !product || !blockInstanceId) {
|
|
501
493
|
var _this$fireAnalyticsEv5;
|
|
502
494
|
(_this$fireAnalyticsEv5 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv5 === void 0 || _this$fireAnalyticsEv5.call(this, (0, _errorHandling.getSourceInfoErrorPayload)('SourceAri, product or blockInstanceId missing', resourceId));
|
|
503
495
|
return Promise.resolve(undefined);
|
|
504
496
|
}
|
|
505
|
-
|
|
506
|
-
var _this$fetchSourceInfo;
|
|
507
|
-
(_this$fetchSourceInfo = this.fetchSourceInfoExperience) === null || _this$fetchSourceInfo === void 0 || _this$fetchSourceInfo.start({});
|
|
508
|
-
}
|
|
497
|
+
(_this$fetchSourceInfo = this.fetchSourceInfoExperience) === null || _this$fetchSourceInfo === void 0 || _this$fetchSourceInfo.start({});
|
|
509
498
|
|
|
510
499
|
// Only use unpublished endpoint if feature flag is enabled
|
|
511
500
|
var isUnpublished = (0, _platformFeatureFlags.fg)('platform_synced_block_patch_1') && ((_existingSyncBlock$da = existingSyncBlock.data) === null || _existingSyncBlock$da === void 0 ? void 0 : _existingSyncBlock$da.status) === 'unpublished';
|
|
@@ -515,55 +504,40 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
515
504
|
// urlType
|
|
516
505
|
isUnpublished).then(function (sourceInfo) {
|
|
517
506
|
if (!sourceInfo) {
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
(_this6$fireAnalyticsE = _this6.fireAnalyticsEvent) === null || _this6$fireAnalyticsE === void 0 || _this6$fireAnalyticsE.call(_this6, (0, _errorHandling.getSourceInfoErrorPayload)('No source info returned', resourceId));
|
|
524
|
-
}
|
|
507
|
+
var _this6$fetchSourceInf, _this6$fireAnalyticsE;
|
|
508
|
+
(_this6$fetchSourceInf = _this6.fetchSourceInfoExperience) === null || _this6$fetchSourceInf === void 0 || _this6$fetchSourceInf.failure({
|
|
509
|
+
reason: 'No source info returned'
|
|
510
|
+
});
|
|
511
|
+
(_this6$fireAnalyticsE = _this6.fireAnalyticsEvent) === null || _this6$fireAnalyticsE === void 0 || _this6$fireAnalyticsE.call(_this6, (0, _errorHandling.getSourceInfoErrorPayload)('No source info returned', resourceId));
|
|
525
512
|
return undefined;
|
|
526
513
|
}
|
|
527
514
|
_this6.updateCacheWithSourceInfo(resourceId, sourceInfo);
|
|
528
515
|
if (sourceInfo.title) {
|
|
529
516
|
_this6.updateSourceTitleSubscriptions(resourceId, sourceInfo.title);
|
|
530
517
|
}
|
|
531
|
-
if (
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
reason: 'Missing title or url'
|
|
539
|
-
});
|
|
540
|
-
(_this6$fireAnalyticsE2 = _this6.fireAnalyticsEvent) === null || _this6$fireAnalyticsE2 === void 0 || _this6$fireAnalyticsE2.call(_this6, (0, _errorHandling.getSourceInfoErrorPayload)('Missing title or url', resourceId));
|
|
541
|
-
}
|
|
542
|
-
return sourceInfo;
|
|
543
|
-
}
|
|
544
|
-
}).catch(function (error) {
|
|
545
|
-
var _this6$fireAnalyticsE3;
|
|
546
|
-
if ((0, _platformFeatureFlags.fg)('platform_synced_block_dogfooding')) {
|
|
547
|
-
var _this6$fetchSourceInf4;
|
|
548
|
-
(_this6$fetchSourceInf4 = _this6.fetchSourceInfoExperience) === null || _this6$fetchSourceInf4 === void 0 || _this6$fetchSourceInf4.failure({
|
|
549
|
-
reason: error.message
|
|
518
|
+
if (sourceInfo.title && sourceInfo.url) {
|
|
519
|
+
var _this6$fetchSourceInf2;
|
|
520
|
+
(_this6$fetchSourceInf2 = _this6.fetchSourceInfoExperience) === null || _this6$fetchSourceInf2 === void 0 || _this6$fetchSourceInf2.success();
|
|
521
|
+
} else {
|
|
522
|
+
var _this6$fetchSourceInf3, _this6$fireAnalyticsE2;
|
|
523
|
+
(_this6$fetchSourceInf3 = _this6.fetchSourceInfoExperience) === null || _this6$fetchSourceInf3 === void 0 || _this6$fetchSourceInf3.failure({
|
|
524
|
+
reason: 'Missing title or url'
|
|
550
525
|
});
|
|
526
|
+
(_this6$fireAnalyticsE2 = _this6.fireAnalyticsEvent) === null || _this6$fireAnalyticsE2 === void 0 || _this6$fireAnalyticsE2.call(_this6, (0, _errorHandling.getSourceInfoErrorPayload)('Missing title or url', resourceId));
|
|
551
527
|
}
|
|
528
|
+
return sourceInfo;
|
|
529
|
+
}).catch(function (error) {
|
|
530
|
+
var _this6$fetchSourceInf4, _this6$fireAnalyticsE3;
|
|
531
|
+
(_this6$fetchSourceInf4 = _this6.fetchSourceInfoExperience) === null || _this6$fetchSourceInf4 === void 0 || _this6$fetchSourceInf4.failure({
|
|
532
|
+
reason: error.message
|
|
533
|
+
});
|
|
552
534
|
(_this6$fireAnalyticsE3 = _this6.fireAnalyticsEvent) === null || _this6$fireAnalyticsE3 === void 0 || _this6$fireAnalyticsE3.call(_this6, (0, _errorHandling.getSourceInfoErrorPayload)(error.message, resourceId));
|
|
553
535
|
return undefined;
|
|
554
536
|
}).finally(function () {
|
|
555
|
-
|
|
556
|
-
_this6.syncBlockSourceInfoRequests.delete(resourceId);
|
|
557
|
-
} else {
|
|
558
|
-
_this6.syncBlockSourceInfoRequestsOld.delete(resourceId);
|
|
559
|
-
}
|
|
537
|
+
_this6.syncBlockSourceInfoRequests.delete(resourceId);
|
|
560
538
|
});
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
return sourceInfoPromise;
|
|
564
|
-
} else {
|
|
565
|
-
this.syncBlockSourceInfoRequestsOld.set(resourceId, true);
|
|
566
|
-
}
|
|
539
|
+
this.syncBlockSourceInfoRequests.set(resourceId, sourceInfoPromise);
|
|
540
|
+
return sourceInfoPromise;
|
|
567
541
|
} catch (error) {
|
|
568
542
|
var _this$fireAnalyticsEv6;
|
|
569
543
|
(0, _monitoring.logException)(error, {
|
|
@@ -583,8 +557,9 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
583
557
|
key: "fetchSyncBlocksData",
|
|
584
558
|
value: (function () {
|
|
585
559
|
var _fetchSyncBlocksData = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(syncBlockNodes) {
|
|
586
|
-
var _this7 = this
|
|
587
|
-
|
|
560
|
+
var _this7 = this,
|
|
561
|
+
_this$fetchExperience;
|
|
562
|
+
var nodesToFetch, data, hasUnexpectedError, hasExpectedError, _this$fetchExperience2, _this$fetchExperience3, _this$fetchExperience4;
|
|
588
563
|
return _regenerator.default.wrap(function _callee2$(_context3) {
|
|
589
564
|
while (1) switch (_context3.prev = _context3.next) {
|
|
590
565
|
case 0:
|
|
@@ -622,9 +597,7 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
622
597
|
nodesToFetch.forEach(function (node) {
|
|
623
598
|
_this7.syncBlockFetchDataRequests.set(node.attrs.resourceId, true);
|
|
624
599
|
});
|
|
625
|
-
|
|
626
|
-
(_this$fetchExperience = this.fetchExperience) === null || _this$fetchExperience === void 0 || _this$fetchExperience.start({});
|
|
627
|
-
}
|
|
600
|
+
(_this$fetchExperience = this.fetchExperience) === null || _this$fetchExperience === void 0 || _this$fetchExperience.start({});
|
|
628
601
|
_context3.next = 12;
|
|
629
602
|
return this.dataProvider.fetchNodesData(nodesToFetch).finally(function () {
|
|
630
603
|
nodesToFetch.forEach(function (node) {
|
|
@@ -648,7 +621,7 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
648
621
|
|
|
649
622
|
// Check if this is a newly added unpublished sync block and notify
|
|
650
623
|
// Only trigger for sync blocks that were just added (not refreshed or loaded on page init)
|
|
651
|
-
if (!syncBlockInstance.error && ((_resolvedSyncBlockIns = resolvedSyncBlockInstance.data) === null || _resolvedSyncBlockIns === void 0 ? void 0 : _resolvedSyncBlockIns.status) === 'unpublished' && _this7.newlyAddedSyncBlocks.has(syncBlockInstance.resourceId) && _this7.onUnpublishedSyncBlockDetected
|
|
624
|
+
if (!syncBlockInstance.error && ((_resolvedSyncBlockIns = resolvedSyncBlockInstance.data) === null || _resolvedSyncBlockIns === void 0 ? void 0 : _resolvedSyncBlockIns.status) === 'unpublished' && _this7.newlyAddedSyncBlocks.has(syncBlockInstance.resourceId) && _this7.onUnpublishedSyncBlockDetected) {
|
|
652
625
|
// Remove from newly added set after checking to prevent duplicate flags
|
|
653
626
|
_this7.newlyAddedSyncBlocks.delete(syncBlockInstance.resourceId);
|
|
654
627
|
_this7.onUnpublishedSyncBlockDetected(resolvedSyncBlockInstance.resourceId);
|
|
@@ -665,7 +638,7 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
665
638
|
hasUnexpectedError = true;
|
|
666
639
|
}
|
|
667
640
|
return;
|
|
668
|
-
} else
|
|
641
|
+
} else {
|
|
669
642
|
var callbacks = _this7.subscriptions.get(syncBlockInstance.resourceId);
|
|
670
643
|
var localIds = callbacks ? Object.keys(callbacks) : [];
|
|
671
644
|
localIds.forEach(function (localId) {
|
|
@@ -675,18 +648,16 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
675
648
|
}
|
|
676
649
|
_this7.fetchSyncBlockSourceInfo(resolvedSyncBlockInstance.resourceId);
|
|
677
650
|
});
|
|
678
|
-
if (
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
(_this$fetchExperience4 = this.fetchExperience) === null || _this$fetchExperience4 === void 0 || _this$fetchExperience4.success();
|
|
689
|
-
}
|
|
651
|
+
if (hasUnexpectedError) {
|
|
652
|
+
(_this$fetchExperience2 = this.fetchExperience) === null || _this$fetchExperience2 === void 0 || _this$fetchExperience2.failure({
|
|
653
|
+
reason: 'Unexpected error during fetch'
|
|
654
|
+
});
|
|
655
|
+
} else if (hasExpectedError) {
|
|
656
|
+
(_this$fetchExperience3 = this.fetchExperience) === null || _this$fetchExperience3 === void 0 || _this$fetchExperience3.abort({
|
|
657
|
+
reason: 'Expected error: NotFound or PermissionDenied'
|
|
658
|
+
});
|
|
659
|
+
} else {
|
|
660
|
+
(_this$fetchExperience4 = this.fetchExperience) === null || _this$fetchExperience4 === void 0 || _this$fetchExperience4.success();
|
|
690
661
|
}
|
|
691
662
|
case 17:
|
|
692
663
|
case "end":
|
|
@@ -810,7 +781,7 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
810
781
|
|
|
811
782
|
// call the callback immediately if we have cached data
|
|
812
783
|
var cachedData = (0, _platformFeatureFlags.fg)('platform_synced_block_patch_1') ? // When feature flag is enabled, use dataProvider cache only
|
|
813
|
-
(_this$dataProvider7 = this.dataProvider) === null || _this$dataProvider7 === void 0 || (_this$dataProvider7 = _this$dataProvider7.getNodeDataFromCache(syncBlockNode)) === null || _this$dataProvider7 === void 0 ? void 0 : _this$dataProvider7.data : (0, _coreUtils.isSSR)()
|
|
784
|
+
(_this$dataProvider7 = this.dataProvider) === null || _this$dataProvider7 === void 0 || (_this$dataProvider7 = _this$dataProvider7.getNodeDataFromCache(syncBlockNode)) === null || _this$dataProvider7 === void 0 ? void 0 : _this$dataProvider7.data : (0, _coreUtils.isSSR)() // in SSR, prefer data provider cache
|
|
814
785
|
? ((_this$dataProvider8 = this.dataProvider) === null || _this$dataProvider8 === void 0 || (_this$dataProvider8 = _this$dataProvider8.getNodeDataFromCache(syncBlockNode)) === null || _this$dataProvider8 === void 0 ? void 0 : _this$dataProvider8.data) || this.getFromCache(resourceId) : this.getFromCache(resourceId) || ((_this$dataProvider9 = this.dataProvider) === null || _this$dataProvider9 === void 0 || (_this$dataProvider9 = _this$dataProvider9.getNodeDataFromCache(syncBlockNode)) === null || _this$dataProvider9 === void 0 ? void 0 : _this$dataProvider9.data);
|
|
815
786
|
if (cachedData) {
|
|
816
787
|
callback(cachedData);
|
|
@@ -991,9 +962,6 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
991
962
|
}, {
|
|
992
963
|
key: "getSSRProviders",
|
|
993
964
|
value: function getSSRProviders(resourceId) {
|
|
994
|
-
if (!(0, _platformFeatureFlags.fg)('platform_synced_block_dogfooding')) {
|
|
995
|
-
return null;
|
|
996
|
-
}
|
|
997
965
|
if (!this.dataProvider) {
|
|
998
966
|
return null;
|
|
999
967
|
}
|
|
@@ -1094,7 +1062,7 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
1094
1062
|
key: "flush",
|
|
1095
1063
|
value: (function () {
|
|
1096
1064
|
var _flush = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
1097
|
-
var success,
|
|
1065
|
+
var success, _this$saveExperience, blocks, updateResult, _this$saveExperience2, _this$fireAnalyticsEv1, _this$saveExperience3, _this$fireAnalyticsEv10, _this$saveExperience4;
|
|
1098
1066
|
return _regenerator.default.wrap(function _callee3$(_context4) {
|
|
1099
1067
|
while (1) switch (_context4.prev = _context4.next) {
|
|
1100
1068
|
case 0:
|
|
@@ -1118,76 +1086,59 @@ var ReferenceSyncBlockStoreManager = exports.ReferenceSyncBlockStoreManager = /*
|
|
|
1118
1086
|
});
|
|
1119
1087
|
});
|
|
1120
1088
|
});
|
|
1121
|
-
if ((0, _platformFeatureFlags.fg)('platform_synced_block_dogfooding')) {
|
|
1122
|
-
_context4.next = 10;
|
|
1123
|
-
break;
|
|
1124
|
-
}
|
|
1125
|
-
if (!(blocks.length === 0)) {
|
|
1126
|
-
_context4.next = 10;
|
|
1127
|
-
break;
|
|
1128
|
-
}
|
|
1129
|
-
this.isCacheDirty = false;
|
|
1130
|
-
return _context4.abrupt("return", true);
|
|
1131
|
-
case 10:
|
|
1132
1089
|
if (this.dataProvider) {
|
|
1133
|
-
_context4.next =
|
|
1090
|
+
_context4.next = 8;
|
|
1134
1091
|
break;
|
|
1135
1092
|
}
|
|
1136
1093
|
throw new Error('Data provider not set');
|
|
1137
|
-
case
|
|
1094
|
+
case 8:
|
|
1138
1095
|
// reset isCacheDirty early to prevent race condition
|
|
1139
1096
|
// There is a race condition where if a user makes changes (create/delete) to a reference sync block
|
|
1140
1097
|
// on a live page and the reference sync block is being saved while the user
|
|
1141
1098
|
// is still making changes, the new changes might not be saved if they all happen
|
|
1142
1099
|
// exactly at a time when the updateReferenceData is being executed asynchronously.
|
|
1143
1100
|
this.isCacheDirty = false;
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
}
|
|
1147
|
-
_context4.next = 16;
|
|
1101
|
+
(_this$saveExperience = this.saveExperience) === null || _this$saveExperience === void 0 || _this$saveExperience.start();
|
|
1102
|
+
_context4.next = 12;
|
|
1148
1103
|
return this.dataProvider.updateReferenceData(blocks);
|
|
1149
|
-
case
|
|
1104
|
+
case 12:
|
|
1150
1105
|
updateResult = _context4.sent;
|
|
1151
1106
|
if (!updateResult.success) {
|
|
1152
1107
|
success = false;
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
});
|
|
1157
|
-
}
|
|
1108
|
+
(_this$saveExperience2 = this.saveExperience) === null || _this$saveExperience2 === void 0 || _this$saveExperience2.failure({
|
|
1109
|
+
reason: updateResult.error || 'Failed to update reference synced blocks on the document'
|
|
1110
|
+
});
|
|
1158
1111
|
(_this$fireAnalyticsEv1 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv1 === void 0 || _this$fireAnalyticsEv1.call(this, (0, _errorHandling.updateReferenceErrorPayload)(updateResult.error || 'Failed to update reference synced blocks on the document'));
|
|
1159
1112
|
}
|
|
1160
|
-
_context4.next =
|
|
1113
|
+
_context4.next = 22;
|
|
1161
1114
|
break;
|
|
1162
|
-
case
|
|
1163
|
-
_context4.prev =
|
|
1115
|
+
case 16:
|
|
1116
|
+
_context4.prev = 16;
|
|
1164
1117
|
_context4.t0 = _context4["catch"](3);
|
|
1165
1118
|
success = false;
|
|
1166
1119
|
(0, _monitoring.logException)(_context4.t0, {
|
|
1167
1120
|
location: 'editor-synced-block-provider/referenceSyncBlockStoreManager'
|
|
1168
1121
|
});
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
});
|
|
1173
|
-
}
|
|
1122
|
+
(_this$saveExperience3 = this.saveExperience) === null || _this$saveExperience3 === void 0 || _this$saveExperience3.failure({
|
|
1123
|
+
reason: _context4.t0.message
|
|
1124
|
+
});
|
|
1174
1125
|
(_this$fireAnalyticsEv10 = this.fireAnalyticsEvent) === null || _this$fireAnalyticsEv10 === void 0 || _this$fireAnalyticsEv10.call(this, (0, _errorHandling.updateReferenceErrorPayload)(_context4.t0.message));
|
|
1175
|
-
case
|
|
1176
|
-
_context4.prev =
|
|
1126
|
+
case 22:
|
|
1127
|
+
_context4.prev = 22;
|
|
1177
1128
|
if (!success) {
|
|
1178
1129
|
// set isCacheDirty back to true for cases where it failed to update the reference synced blocks on the BE
|
|
1179
1130
|
this.isCacheDirty = true;
|
|
1180
|
-
} else
|
|
1131
|
+
} else {
|
|
1181
1132
|
(_this$saveExperience4 = this.saveExperience) === null || _this$saveExperience4 === void 0 || _this$saveExperience4.success();
|
|
1182
1133
|
}
|
|
1183
|
-
return _context4.finish(
|
|
1184
|
-
case
|
|
1134
|
+
return _context4.finish(22);
|
|
1135
|
+
case 25:
|
|
1185
1136
|
return _context4.abrupt("return", success);
|
|
1186
|
-
case
|
|
1137
|
+
case 26:
|
|
1187
1138
|
case "end":
|
|
1188
1139
|
return _context4.stop();
|
|
1189
1140
|
}
|
|
1190
|
-
}, _callee3, this, [[3,
|
|
1141
|
+
}, _callee3, this, [[3, 16, 22, 25]]);
|
|
1191
1142
|
}));
|
|
1192
1143
|
function flush() {
|
|
1193
1144
|
return _flush.apply(this, arguments);
|