@atlaskit/editor-card-provider 6.7.5 → 6.7.8

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,26 @@
1
1
  # @atlaskit/editor-card-provider
2
2
 
3
+ ## 6.7.8
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 6.7.7
10
+
11
+ ### Patch Changes
12
+
13
+ - [`1e1cd867149d8`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/1e1cd867149d8) -
14
+ Add platform_sl_fix_cache_unresolved - cache Smart Link with resolved status, related to
15
+ platform_editor_smartlink_local_cache
16
+ - Updated dependencies
17
+
18
+ ## 6.7.6
19
+
20
+ ### Patch Changes
21
+
22
+ - Updated dependencies
23
+
3
24
  ## 6.7.5
4
25
 
5
26
  ### Patch Changes
@@ -250,23 +250,49 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function (_re
250
250
  // if we can load a response from cache, use it first
251
251
  var key = this.nodeDataKey(jsonNode);
252
252
  var details = this.smartCardLocalCacheClient.getItem(key);
253
- if (details) {
254
- callback({
255
- data: details
256
- });
257
- }
253
+ if ((0, _expValEquals.expValEquals)('platform_sl_fix_cache_unresolved', 'isEnabled', true)) {
254
+ // NAVX-4712: Handle responses with non-resolved statuses that were previously cached
255
+ var isResolvedCachedResponse = details && details.meta && (0, _linkingCommon.getStatus)(details) === 'resolved';
256
+ if (isResolvedCachedResponse) {
257
+ callback({
258
+ data: details
259
+ });
260
+ }
258
261
 
259
- // if parent class NodeDataProvider has cached the network request for the node
260
- // we can skip fetching the data async and updating the session storage cache
261
- var cacheStatus = this.getCacheStatusForNode(jsonNode);
262
- if (cacheStatus === 'network') {
263
- return;
262
+ // if parent class NodeDataProvider has cached the network request for the node
263
+ // we can skip fetching the data async and updating the session storage cache
264
+ if (isResolvedCachedResponse && this.getCacheStatusForNode(jsonNode) === 'network') {
265
+ return;
266
+ }
267
+ } else {
268
+ if (details) {
269
+ callback({
270
+ data: details
271
+ });
272
+ }
273
+
274
+ // if parent class NodeDataProvider has cached the network request for the node
275
+ // we can skip fetching the data async and updating the session storage cache
276
+ var cacheStatus = this.getCacheStatusForNode(jsonNode);
277
+ if (cacheStatus === 'network') {
278
+ return;
279
+ }
264
280
  }
265
281
 
266
282
  // fetch the latest data async and update the session storage cache
267
283
  this.getDataAsync(node, function (payload) {
268
- if (payload.data && !payload.error) {
269
- _this2.smartCardLocalCacheClient.setItem(key, payload.data);
284
+ if ((0, _expValEquals.expValEquals)('platform_sl_fix_cache_unresolved', 'isEnabled', true)) {
285
+ var response = payload.data;
286
+ if (!payload.error && response !== null && response !== void 0 && response.meta) {
287
+ var status = (0, _linkingCommon.getStatus)(response);
288
+ if (status === 'resolved') {
289
+ _this2.smartCardLocalCacheClient.setItem(key, response);
290
+ }
291
+ }
292
+ } else {
293
+ if (payload.data && !payload.error) {
294
+ _this2.smartCardLocalCacheClient.setItem(key, payload.data);
295
+ }
270
296
  }
271
297
  callback(payload);
272
298
  });
@@ -160,23 +160,49 @@ 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 (details) {
164
- callback({
165
- data: details
166
- });
167
- }
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
+ }
168
171
 
169
- // if parent class NodeDataProvider has cached the network request for the node
170
- // we can skip fetching the data async and updating the session storage cache
171
- const cacheStatus = this.getCacheStatusForNode(jsonNode);
172
- if (cacheStatus === 'network') {
173
- return;
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
+ }
183
+
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
+ }
174
190
  }
175
191
 
176
192
  // fetch the latest data async and update the session storage cache
177
193
  this.getDataAsync(node, payload => {
178
- if (payload.data && !payload.error) {
179
- this.smartCardLocalCacheClient.setItem(key, payload.data);
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);
205
+ }
180
206
  }
181
207
  callback(payload);
182
208
  });
@@ -242,23 +242,49 @@ export var EditorCardProvider = /*#__PURE__*/function (_ref) {
242
242
  // if we can load a response from cache, use it first
243
243
  var key = this.nodeDataKey(jsonNode);
244
244
  var details = this.smartCardLocalCacheClient.getItem(key);
245
- if (details) {
246
- callback({
247
- data: details
248
- });
249
- }
245
+ if (expValEquals('platform_sl_fix_cache_unresolved', 'isEnabled', true)) {
246
+ // NAVX-4712: Handle responses with non-resolved statuses that were previously cached
247
+ var isResolvedCachedResponse = details && details.meta && getStatus(details) === 'resolved';
248
+ if (isResolvedCachedResponse) {
249
+ callback({
250
+ data: details
251
+ });
252
+ }
250
253
 
251
- // if parent class NodeDataProvider has cached the network request for the node
252
- // we can skip fetching the data async and updating the session storage cache
253
- var cacheStatus = this.getCacheStatusForNode(jsonNode);
254
- if (cacheStatus === 'network') {
255
- return;
254
+ // if parent class NodeDataProvider has cached the network request for the node
255
+ // we can skip fetching the data async and updating the session storage cache
256
+ if (isResolvedCachedResponse && this.getCacheStatusForNode(jsonNode) === 'network') {
257
+ return;
258
+ }
259
+ } else {
260
+ if (details) {
261
+ callback({
262
+ data: details
263
+ });
264
+ }
265
+
266
+ // if parent class NodeDataProvider has cached the network request for the node
267
+ // we can skip fetching the data async and updating the session storage cache
268
+ var cacheStatus = this.getCacheStatusForNode(jsonNode);
269
+ if (cacheStatus === 'network') {
270
+ return;
271
+ }
256
272
  }
257
273
 
258
274
  // fetch the latest data async and update the session storage cache
259
275
  this.getDataAsync(node, function (payload) {
260
- if (payload.data && !payload.error) {
261
- _this2.smartCardLocalCacheClient.setItem(key, payload.data);
276
+ if (expValEquals('platform_sl_fix_cache_unresolved', 'isEnabled', true)) {
277
+ var response = payload.data;
278
+ if (!payload.error && response !== null && response !== void 0 && response.meta) {
279
+ var status = getStatus(response);
280
+ if (status === 'resolved') {
281
+ _this2.smartCardLocalCacheClient.setItem(key, response);
282
+ }
283
+ }
284
+ } else {
285
+ if (payload.data && !payload.error) {
286
+ _this2.smartCardLocalCacheClient.setItem(key, payload.data);
287
+ }
262
288
  }
263
289
  callback(payload);
264
290
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-card-provider",
3
- "version": "6.7.5",
3
+ "version": "6.7.8",
4
4
  "description": "Contains the EditorCardProvider, for determining smart card behaviour in the editor.",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -39,7 +39,7 @@
39
39
  "@atlaskit/linking-types": "^14.2.0",
40
40
  "@atlaskit/node-data-provider": "^11.0.0",
41
41
  "@atlaskit/platform-feature-flags": "^1.1.0",
42
- "@atlaskit/tmp-editor-statsig": "^69.0.0",
42
+ "@atlaskit/tmp-editor-statsig": "^71.0.0",
43
43
  "@babel/runtime": "^7.0.0",
44
44
  "dataloader": "^2.1.0"
45
45
  },