@atlaskit/editor-card-provider 6.8.2 → 6.8.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.
@@ -160,48 +160,27 @@ export class EditorCardProvider extends NodeDataProvider {
160
160
  // if we can load a response from cache, use it first
161
161
  const key = this.nodeDataKey(jsonNode);
162
162
  const details = this.smartCardLocalCacheClient.getItem(key);
163
- if (expValEquals('platform_sl_fix_cache_unresolved', 'isEnabled', true)) {
164
- // NAVX-4712: Handle responses with non-resolved statuses that were previously cached
165
- const isResolvedCachedResponse = details && details.meta && getStatus(details) === 'resolved';
166
- if (isResolvedCachedResponse) {
167
- callback({
168
- data: details
169
- });
170
- }
171
-
172
- // if parent class NodeDataProvider has cached the network request for the node
173
- // we can skip fetching the data async and updating the session storage cache
174
- if (isResolvedCachedResponse && this.getCacheStatusForNode(jsonNode) === 'network') {
175
- return;
176
- }
177
- } else {
178
- if (details) {
179
- callback({
180
- data: details
181
- });
182
- }
163
+ // NAVX-4712: Handle responses with non-resolved statuses that were previously cached
164
+ const isResolvedCachedResponse = details && details.meta && getStatus(details) === 'resolved';
165
+ if (isResolvedCachedResponse) {
166
+ callback({
167
+ data: details
168
+ });
169
+ }
183
170
 
184
- // if parent class NodeDataProvider has cached the network request for the node
185
- // we can skip fetching the data async and updating the session storage cache
186
- const cacheStatus = this.getCacheStatusForNode(jsonNode);
187
- if (cacheStatus === 'network') {
188
- return;
189
- }
171
+ // if parent class NodeDataProvider has cached the network request for the node
172
+ // we can skip fetching the data async and updating the session storage cache
173
+ if (isResolvedCachedResponse && this.getCacheStatusForNode(jsonNode) === 'network') {
174
+ return;
190
175
  }
191
176
 
192
177
  // fetch the latest data async and update the session storage cache
193
178
  this.getDataAsync(node, payload => {
194
- if (expValEquals('platform_sl_fix_cache_unresolved', 'isEnabled', true)) {
195
- const response = payload.data;
196
- if (!payload.error && response !== null && response !== void 0 && response.meta) {
197
- const status = getStatus(response);
198
- if (status === 'resolved') {
199
- this.smartCardLocalCacheClient.setItem(key, response);
200
- }
201
- }
202
- } else {
203
- if (payload.data && !payload.error) {
204
- this.smartCardLocalCacheClient.setItem(key, payload.data);
179
+ const response = payload.data;
180
+ if (!payload.error && response !== null && response !== void 0 && response.meta) {
181
+ const status = getStatus(response);
182
+ if (status === 'resolved') {
183
+ this.smartCardLocalCacheClient.setItem(key, response);
205
184
  }
206
185
  }
207
186
  callback(payload);
package/dist/esm/api.js CHANGED
@@ -32,8 +32,8 @@ function _request() {
32
32
  _request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(method, url,
33
33
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
34
34
  data, headers) {
35
- var requestConfig, response;
36
- return _regeneratorRuntime.wrap(function _callee$(_context) {
35
+ var requestConfig, response, _t;
36
+ return _regeneratorRuntime.wrap(function (_context) {
37
37
  while (1) switch (_context.prev = _context.next) {
38
38
  case 0:
39
39
  requestConfig = _objectSpread({
@@ -48,35 +48,35 @@ function _request() {
48
48
  body: JSON.stringify(data)
49
49
  } : {});
50
50
  _context.prev = 1;
51
- _context.next = 4;
51
+ _context.next = 2;
52
52
  return fetch(url, requestConfig);
53
- case 4:
53
+ case 2:
54
54
  response = _context.sent;
55
55
  if (!(response.ok || ALLOWED_RESPONSE_STATUS_CODES.includes(response.status))) {
56
- _context.next = 9;
56
+ _context.next = 4;
57
57
  break;
58
58
  }
59
- _context.next = 8;
59
+ _context.next = 3;
60
60
  return response.json();
61
- case 8:
61
+ case 3:
62
62
  return _context.abrupt("return", _context.sent);
63
- case 9:
63
+ case 4:
64
64
  throw response;
65
- case 12:
66
- _context.prev = 12;
67
- _context.t0 = _context["catch"](1);
68
- if (!(typeof _context.t0 === 'string' || _context.t0 instanceof TypeError)) {
69
- _context.next = 16;
65
+ case 5:
66
+ _context.prev = 5;
67
+ _t = _context["catch"](1);
68
+ if (!(typeof _t === 'string' || _t instanceof TypeError)) {
69
+ _context.next = 6;
70
70
  break;
71
71
  }
72
- throw new NetworkError(_context.t0);
73
- case 16:
74
- throw _context.t0;
75
- case 17:
72
+ throw new NetworkError(_t);
73
+ case 6:
74
+ throw _t;
75
+ case 7:
76
76
  case "end":
77
77
  return _context.stop();
78
78
  }
79
- }, _callee, null, [[1, 12]]);
79
+ }, _callee, null, [[1, 5]]);
80
80
  }));
81
81
  return _request.apply(this, arguments);
82
82
  }