@atlaskit/node-data-provider 7.4.0 → 7.5.1
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,21 @@
|
|
|
1
1
|
# @atlaskit/node-data-provider
|
|
2
2
|
|
|
3
|
+
## 7.5.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`a05464ea42678`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a05464ea42678) -
|
|
8
|
+
EDITOR-2791 bump adf-schema
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 7.5.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [`e3f45edd75547`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e3f45edd75547) -
|
|
16
|
+
[https://product-fabric.atlassian.net/browse/ED-29647](ED-29647) - OTP will not use network data
|
|
17
|
+
if preloaded data is unavailable during SSR rendering
|
|
18
|
+
|
|
3
19
|
## 7.4.0
|
|
4
20
|
|
|
5
21
|
### Minor Changes
|
|
@@ -151,22 +151,20 @@ var NodeDataProvider = exports.NodeDataProvider = /*#__PURE__*/function () {
|
|
|
151
151
|
case 4:
|
|
152
152
|
dataKey = this.nodeDataKey(jsonNode);
|
|
153
153
|
dataFromCache = this.cache[dataKey];
|
|
154
|
-
if (
|
|
155
|
-
|
|
156
|
-
|
|
154
|
+
if (dataFromCache !== undefined) {
|
|
155
|
+
// If we have the data in the SSR data, we can use it directly
|
|
156
|
+
callback({
|
|
157
|
+
data: dataFromCache.data
|
|
158
|
+
});
|
|
157
159
|
}
|
|
158
|
-
// If we have the data in the SSR data, we can use it directly
|
|
159
|
-
callback({
|
|
160
|
-
data: dataFromCache.data
|
|
161
|
-
});
|
|
162
160
|
if (!(0, _coreUtils.isSSR)()) {
|
|
163
|
-
_context.next =
|
|
161
|
+
_context.next = 9;
|
|
164
162
|
break;
|
|
165
163
|
}
|
|
166
164
|
return _context.abrupt("return");
|
|
167
|
-
case
|
|
165
|
+
case 9:
|
|
168
166
|
if (!((dataFromCache === null || dataFromCache === void 0 ? void 0 : dataFromCache.source) !== 'network')) {
|
|
169
|
-
_context.next =
|
|
167
|
+
_context.next = 41;
|
|
170
168
|
break;
|
|
171
169
|
}
|
|
172
170
|
// Store the current cache version before making the request,
|
|
@@ -177,38 +175,38 @@ var NodeDataProvider = exports.NodeDataProvider = /*#__PURE__*/function () {
|
|
|
177
175
|
// to avoid duplicate requests.
|
|
178
176
|
networkRequestInFlight = this.networkRequestsInFlight[networkRequestInFlightKey];
|
|
179
177
|
if (!networkRequestInFlight) {
|
|
180
|
-
_context.next =
|
|
178
|
+
_context.next = 25;
|
|
181
179
|
break;
|
|
182
180
|
}
|
|
183
|
-
_context.prev =
|
|
184
|
-
_context.next =
|
|
181
|
+
_context.prev = 14;
|
|
182
|
+
_context.next = 17;
|
|
185
183
|
return networkRequestInFlight;
|
|
186
|
-
case
|
|
184
|
+
case 17:
|
|
187
185
|
data = _context.sent;
|
|
188
186
|
callback({
|
|
189
187
|
data: data
|
|
190
188
|
});
|
|
191
|
-
_context.next =
|
|
189
|
+
_context.next = 24;
|
|
192
190
|
break;
|
|
193
|
-
case
|
|
194
|
-
_context.prev =
|
|
195
|
-
_context.t0 = _context["catch"](
|
|
191
|
+
case 21:
|
|
192
|
+
_context.prev = 21;
|
|
193
|
+
_context.t0 = _context["catch"](14);
|
|
196
194
|
callback({
|
|
197
195
|
error: _context.t0 instanceof Error ? _context.t0 : new Error(String(_context.t0))
|
|
198
196
|
});
|
|
199
|
-
case
|
|
197
|
+
case 24:
|
|
200
198
|
return _context.abrupt("return");
|
|
201
|
-
case
|
|
202
|
-
_context.prev =
|
|
199
|
+
case 25:
|
|
200
|
+
_context.prev = 25;
|
|
203
201
|
dataPromise = this.fetchNodesData([jsonNode]).then(function (_ref3) {
|
|
204
202
|
var _ref4 = (0, _slicedToArray2.default)(_ref3, 1),
|
|
205
203
|
value = _ref4[0];
|
|
206
204
|
return value;
|
|
207
205
|
}); // Store the promise in the in-flight requests map
|
|
208
206
|
this.networkRequestsInFlight[networkRequestInFlightKey] = dataPromise;
|
|
209
|
-
_context.next =
|
|
207
|
+
_context.next = 30;
|
|
210
208
|
return dataPromise;
|
|
211
|
-
case
|
|
209
|
+
case 30:
|
|
212
210
|
_data = _context.sent;
|
|
213
211
|
// We need to call the callback with the data with result even if the cache version has changed,
|
|
214
212
|
// so all promises that are waiting for the data can resolve.
|
|
@@ -225,25 +223,25 @@ var NodeDataProvider = exports.NodeDataProvider = /*#__PURE__*/function () {
|
|
|
225
223
|
data: _data
|
|
226
224
|
};
|
|
227
225
|
}
|
|
228
|
-
_context.next =
|
|
226
|
+
_context.next = 38;
|
|
229
227
|
break;
|
|
230
|
-
case
|
|
231
|
-
_context.prev =
|
|
232
|
-
_context.t1 = _context["catch"](
|
|
228
|
+
case 35:
|
|
229
|
+
_context.prev = 35;
|
|
230
|
+
_context.t1 = _context["catch"](25);
|
|
233
231
|
// If an error occurs, we call the callback with the error
|
|
234
232
|
callback({
|
|
235
233
|
error: _context.t1 instanceof Error ? _context.t1 : new Error(String(_context.t1))
|
|
236
234
|
});
|
|
237
|
-
case
|
|
238
|
-
_context.prev =
|
|
235
|
+
case 38:
|
|
236
|
+
_context.prev = 38;
|
|
239
237
|
// Ensure we clean up the in-flight request entry
|
|
240
238
|
delete this.networkRequestsInFlight[networkRequestInFlightKey];
|
|
241
|
-
return _context.finish(
|
|
242
|
-
case
|
|
239
|
+
return _context.finish(38);
|
|
240
|
+
case 41:
|
|
243
241
|
case "end":
|
|
244
242
|
return _context.stop();
|
|
245
243
|
}
|
|
246
|
-
}, _callee, this, [[
|
|
244
|
+
}, _callee, this, [[14, 21], [25, 35, 38, 41]]);
|
|
247
245
|
}));
|
|
248
246
|
function getDataAsync(_x, _x2) {
|
|
249
247
|
return _getDataAsync.apply(this, arguments);
|
|
@@ -151,10 +151,11 @@ export class NodeDataProvider {
|
|
|
151
151
|
callback({
|
|
152
152
|
data: dataFromCache.data
|
|
153
153
|
});
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
154
|
+
}
|
|
155
|
+
if (isSSR()) {
|
|
156
|
+
// During SSR, we only use the cache and never fetch from the network.
|
|
157
|
+
// Use loading state instead.
|
|
158
|
+
return;
|
|
158
159
|
}
|
|
159
160
|
|
|
160
161
|
// If no data is available in the cache, or the data is from the network,
|
|
@@ -148,22 +148,20 @@ export var NodeDataProvider = /*#__PURE__*/function () {
|
|
|
148
148
|
case 4:
|
|
149
149
|
dataKey = this.nodeDataKey(jsonNode);
|
|
150
150
|
dataFromCache = this.cache[dataKey];
|
|
151
|
-
if (
|
|
152
|
-
|
|
153
|
-
|
|
151
|
+
if (dataFromCache !== undefined) {
|
|
152
|
+
// If we have the data in the SSR data, we can use it directly
|
|
153
|
+
callback({
|
|
154
|
+
data: dataFromCache.data
|
|
155
|
+
});
|
|
154
156
|
}
|
|
155
|
-
// If we have the data in the SSR data, we can use it directly
|
|
156
|
-
callback({
|
|
157
|
-
data: dataFromCache.data
|
|
158
|
-
});
|
|
159
157
|
if (!isSSR()) {
|
|
160
|
-
_context.next =
|
|
158
|
+
_context.next = 9;
|
|
161
159
|
break;
|
|
162
160
|
}
|
|
163
161
|
return _context.abrupt("return");
|
|
164
|
-
case
|
|
162
|
+
case 9:
|
|
165
163
|
if (!((dataFromCache === null || dataFromCache === void 0 ? void 0 : dataFromCache.source) !== 'network')) {
|
|
166
|
-
_context.next =
|
|
164
|
+
_context.next = 41;
|
|
167
165
|
break;
|
|
168
166
|
}
|
|
169
167
|
// Store the current cache version before making the request,
|
|
@@ -174,38 +172,38 @@ export var NodeDataProvider = /*#__PURE__*/function () {
|
|
|
174
172
|
// to avoid duplicate requests.
|
|
175
173
|
networkRequestInFlight = this.networkRequestsInFlight[networkRequestInFlightKey];
|
|
176
174
|
if (!networkRequestInFlight) {
|
|
177
|
-
_context.next =
|
|
175
|
+
_context.next = 25;
|
|
178
176
|
break;
|
|
179
177
|
}
|
|
180
|
-
_context.prev =
|
|
181
|
-
_context.next =
|
|
178
|
+
_context.prev = 14;
|
|
179
|
+
_context.next = 17;
|
|
182
180
|
return networkRequestInFlight;
|
|
183
|
-
case
|
|
181
|
+
case 17:
|
|
184
182
|
data = _context.sent;
|
|
185
183
|
callback({
|
|
186
184
|
data: data
|
|
187
185
|
});
|
|
188
|
-
_context.next =
|
|
186
|
+
_context.next = 24;
|
|
189
187
|
break;
|
|
190
|
-
case
|
|
191
|
-
_context.prev =
|
|
192
|
-
_context.t0 = _context["catch"](
|
|
188
|
+
case 21:
|
|
189
|
+
_context.prev = 21;
|
|
190
|
+
_context.t0 = _context["catch"](14);
|
|
193
191
|
callback({
|
|
194
192
|
error: _context.t0 instanceof Error ? _context.t0 : new Error(String(_context.t0))
|
|
195
193
|
});
|
|
196
|
-
case
|
|
194
|
+
case 24:
|
|
197
195
|
return _context.abrupt("return");
|
|
198
|
-
case
|
|
199
|
-
_context.prev =
|
|
196
|
+
case 25:
|
|
197
|
+
_context.prev = 25;
|
|
200
198
|
dataPromise = this.fetchNodesData([jsonNode]).then(function (_ref3) {
|
|
201
199
|
var _ref4 = _slicedToArray(_ref3, 1),
|
|
202
200
|
value = _ref4[0];
|
|
203
201
|
return value;
|
|
204
202
|
}); // Store the promise in the in-flight requests map
|
|
205
203
|
this.networkRequestsInFlight[networkRequestInFlightKey] = dataPromise;
|
|
206
|
-
_context.next =
|
|
204
|
+
_context.next = 30;
|
|
207
205
|
return dataPromise;
|
|
208
|
-
case
|
|
206
|
+
case 30:
|
|
209
207
|
_data = _context.sent;
|
|
210
208
|
// We need to call the callback with the data with result even if the cache version has changed,
|
|
211
209
|
// so all promises that are waiting for the data can resolve.
|
|
@@ -222,25 +220,25 @@ export var NodeDataProvider = /*#__PURE__*/function () {
|
|
|
222
220
|
data: _data
|
|
223
221
|
};
|
|
224
222
|
}
|
|
225
|
-
_context.next =
|
|
223
|
+
_context.next = 38;
|
|
226
224
|
break;
|
|
227
|
-
case
|
|
228
|
-
_context.prev =
|
|
229
|
-
_context.t1 = _context["catch"](
|
|
225
|
+
case 35:
|
|
226
|
+
_context.prev = 35;
|
|
227
|
+
_context.t1 = _context["catch"](25);
|
|
230
228
|
// If an error occurs, we call the callback with the error
|
|
231
229
|
callback({
|
|
232
230
|
error: _context.t1 instanceof Error ? _context.t1 : new Error(String(_context.t1))
|
|
233
231
|
});
|
|
234
|
-
case
|
|
235
|
-
_context.prev =
|
|
232
|
+
case 38:
|
|
233
|
+
_context.prev = 38;
|
|
236
234
|
// Ensure we clean up the in-flight request entry
|
|
237
235
|
delete this.networkRequestsInFlight[networkRequestInFlightKey];
|
|
238
|
-
return _context.finish(
|
|
239
|
-
case
|
|
236
|
+
return _context.finish(38);
|
|
237
|
+
case 41:
|
|
240
238
|
case "end":
|
|
241
239
|
return _context.stop();
|
|
242
240
|
}
|
|
243
|
-
}, _callee, this, [[
|
|
241
|
+
}, _callee, this, [[14, 21], [25, 35, 38, 41]]);
|
|
244
242
|
}));
|
|
245
243
|
function getDataAsync(_x, _x2) {
|
|
246
244
|
return _getDataAsync.apply(this, arguments);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/node-data-provider",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.5.1",
|
|
4
4
|
"description": "Node data provider for @atlaskit/editor-core plugins and @atlaskit/renderer",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -19,14 +19,14 @@
|
|
|
19
19
|
"sideEffects": false,
|
|
20
20
|
"atlaskit:src": "src/index.ts",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@atlaskit/adf-schema": "^51.
|
|
23
|
-
"@atlaskit/adf-utils": "^19.
|
|
22
|
+
"@atlaskit/adf-schema": "^51.4.0",
|
|
23
|
+
"@atlaskit/adf-utils": "^19.26.0",
|
|
24
24
|
"@atlaskit/editor-json-transformer": "^8.31.0",
|
|
25
25
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
26
26
|
"@babel/runtime": "^7.0.0"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
|
-
"@atlaskit/editor-common": "^110.
|
|
29
|
+
"@atlaskit/editor-common": "^110.32.0"
|
|
30
30
|
},
|
|
31
31
|
"techstack": {
|
|
32
32
|
"@atlassian/frontend": {
|