@atlaskit/editor-synced-block-provider 3.10.0 → 3.11.0

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 CHANGED
@@ -1,5 +1,12 @@
1
1
  # @atlaskit/editor-synced-block-provider
2
2
 
3
+ ## 3.11.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`7b4cb91fc67a6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7b4cb91fc67a6) -
8
+ Do not immediately show error state on initial load of blocks
9
+
3
10
  ## 3.10.0
4
11
 
5
12
  ### Minor Changes
@@ -115,11 +115,21 @@ var SyncBlockProvider = exports.SyncBlockProvider = /*#__PURE__*/function (_Sync
115
115
  case 10:
116
116
  _context.prev = 10;
117
117
  _context.t0 = _context["catch"](4);
118
- return _context.abrupt("return", blockIdentifiers.map(function (blockIdentifier) {
119
- return {
120
- error: _types.SyncBlockError.Errored,
121
- resourceId: blockIdentifier.resourceId
122
- };
118
+ return _context.abrupt("return", Promise.allSettled(blockIdentifiers.map(function (blockIdentifier) {
119
+ return _this2.fetchProvider.fetchData(blockIdentifier.resourceId).then(function (data) {
120
+ return data;
121
+ }, function () {
122
+ return {
123
+ error: _types.SyncBlockError.Errored,
124
+ resourceId: blockIdentifier.resourceId
125
+ };
126
+ });
127
+ })).then(function (results) {
128
+ return results.filter(function (result) {
129
+ return result.status === 'fulfilled';
130
+ }).map(function (result) {
131
+ return result.value;
132
+ });
123
133
  }));
124
134
  case 13:
125
135
  _context.next = 16;
@@ -66,11 +66,22 @@ export class SyncBlockProvider extends SyncBlockDataProvider {
66
66
  try {
67
67
  return await this.fetchProvider.batchFetchData(blockIdentifiers);
68
68
  } catch {
69
- // If batch fetch fails, return error for all resourceIds
70
- return blockIdentifiers.map(blockIdentifier => ({
71
- error: SyncBlockError.Errored,
72
- resourceId: blockIdentifier.resourceId
73
- }));
69
+ // If batch fetch fails, fall back to individual fetch behavior
70
+ // This allows loading states to be shown before errors, matching non-batch behavior
71
+ return Promise.allSettled(blockIdentifiers.map(blockIdentifier => {
72
+ return this.fetchProvider.fetchData(blockIdentifier.resourceId).then(data => {
73
+ return data;
74
+ }, () => {
75
+ return {
76
+ error: SyncBlockError.Errored,
77
+ resourceId: blockIdentifier.resourceId
78
+ };
79
+ });
80
+ })).then(results => {
81
+ return results.filter(result => {
82
+ return result.status === 'fulfilled';
83
+ }).map(result => result.value);
84
+ });
74
85
  }
75
86
  } else {
76
87
  return Promise.allSettled(blockIdentifiers.map(blockIdentifier => {
@@ -108,11 +108,21 @@ export var SyncBlockProvider = /*#__PURE__*/function (_SyncBlockDataProvide) {
108
108
  case 10:
109
109
  _context.prev = 10;
110
110
  _context.t0 = _context["catch"](4);
111
- return _context.abrupt("return", blockIdentifiers.map(function (blockIdentifier) {
112
- return {
113
- error: SyncBlockError.Errored,
114
- resourceId: blockIdentifier.resourceId
115
- };
111
+ return _context.abrupt("return", Promise.allSettled(blockIdentifiers.map(function (blockIdentifier) {
112
+ return _this2.fetchProvider.fetchData(blockIdentifier.resourceId).then(function (data) {
113
+ return data;
114
+ }, function () {
115
+ return {
116
+ error: SyncBlockError.Errored,
117
+ resourceId: blockIdentifier.resourceId
118
+ };
119
+ });
120
+ })).then(function (results) {
121
+ return results.filter(function (result) {
122
+ return result.status === 'fulfilled';
123
+ }).map(function (result) {
124
+ return result.value;
125
+ });
116
126
  }));
117
127
  case 13:
118
128
  _context.next = 16;
package/package.json CHANGED
@@ -77,7 +77,7 @@
77
77
  }
78
78
  },
79
79
  "name": "@atlaskit/editor-synced-block-provider",
80
- "version": "3.10.0",
80
+ "version": "3.11.0",
81
81
  "description": "Synced Block Provider for @atlaskit/editor-plugin-synced-block",
82
82
  "author": "Atlassian Pty Ltd",
83
83
  "license": "Apache-2.0",