@atlaskit/link-datasource 7.3.3 → 7.3.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.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/link-datasource
|
|
2
2
|
|
|
3
|
+
## 7.3.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`11bc578982514`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/11bc578982514) -
|
|
8
|
+
Gate deduplication of datasource rows that share an ARI behind `platform_sllv_duplicated_row`.
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 7.3.3
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -13,6 +13,7 @@ var _react = require("react");
|
|
|
13
13
|
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
|
14
14
|
var _isFedramp = require("@atlaskit/atlassian-context/is-fedramp");
|
|
15
15
|
var _useDataSourceClientExtension = require("@atlaskit/link-client-extension/use-data-source-client-extension");
|
|
16
|
+
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
16
17
|
var _analytics = require("../analytics");
|
|
17
18
|
var _state = require("../state");
|
|
18
19
|
var _useDiscoverActions2 = require("../state/actions/useDiscoverActions");
|
|
@@ -106,6 +107,7 @@ var useDatasourceTableState = exports.useDatasourceTableState = function useData
|
|
|
106
107
|
providerName = _useState30[0],
|
|
107
108
|
setProviderName = _useState30[1];
|
|
108
109
|
var abortController = (0, _react.useRef)(new AbortController());
|
|
110
|
+
var responseItemAris = (0, _react.useRef)(new Set());
|
|
109
111
|
var _useDatasourceClientE = (0, _useDataSourceClientExtension.useDatasourceClientExtension)(),
|
|
110
112
|
getDatasourceData = _useDatasourceClientE.getDatasourceData,
|
|
111
113
|
getDatasourceDetails = _useDatasourceClientE.getDatasourceDetails;
|
|
@@ -234,6 +236,8 @@ var useDatasourceTableState = exports.useDatasourceTableState = function useData
|
|
|
234
236
|
nextPageCursor,
|
|
235
237
|
_totalCount,
|
|
236
238
|
schema,
|
|
239
|
+
isDuplicateRowDeduplicationEnabled,
|
|
240
|
+
itemsToAdd,
|
|
237
241
|
integrationKey,
|
|
238
242
|
entityType,
|
|
239
243
|
newIds,
|
|
@@ -309,11 +313,27 @@ var useDatasourceTableState = exports.useDatasourceTableState = function useData
|
|
|
309
313
|
setDestinationObjectTypes(_destinationObjectTypes);
|
|
310
314
|
setTotalCount(_totalCount);
|
|
311
315
|
setNextCursor(nextPageCursor);
|
|
316
|
+
isDuplicateRowDeduplicationEnabled = (0, _fg.fg)('platform_sllv_duplicated_row');
|
|
317
|
+
if (shouldRequestFirstPage && isDuplicateRowDeduplicationEnabled) {
|
|
318
|
+
responseItemAris.current.clear();
|
|
319
|
+
}
|
|
320
|
+
itemsToAdd = isDuplicateRowDeduplicationEnabled ? items.filter(function (item) {
|
|
321
|
+
var _item$ari;
|
|
322
|
+
var ari = (_item$ari = item.ari) === null || _item$ari === void 0 ? void 0 : _item$ari.data;
|
|
323
|
+
if (typeof ari !== 'string') {
|
|
324
|
+
return true;
|
|
325
|
+
}
|
|
326
|
+
if (responseItemAris.current.has(ari)) {
|
|
327
|
+
return false;
|
|
328
|
+
}
|
|
329
|
+
responseItemAris.current.add(ari);
|
|
330
|
+
return true;
|
|
331
|
+
}) : items;
|
|
312
332
|
setResponseItems(function (currentResponseItems) {
|
|
313
333
|
if (shouldRequestFirstPage) {
|
|
314
|
-
return
|
|
334
|
+
return itemsToAdd;
|
|
315
335
|
}
|
|
316
|
-
return [].concat((0, _toConsumableArray2.default)(currentResponseItems), (0, _toConsumableArray2.default)(
|
|
336
|
+
return [].concat((0, _toConsumableArray2.default)(currentResponseItems), (0, _toConsumableArray2.default)(itemsToAdd));
|
|
317
337
|
});
|
|
318
338
|
|
|
319
339
|
/**
|
|
@@ -324,15 +344,15 @@ var useDatasourceTableState = exports.useDatasourceTableState = function useData
|
|
|
324
344
|
* When `entityType` is undefined, we should not discover actions it prevents unnecessary requests to Actions service
|
|
325
345
|
*/
|
|
326
346
|
entityType = objectTypesEntity;
|
|
327
|
-
newIds = onAddItems(
|
|
347
|
+
newIds = onAddItems(itemsToAdd, typeof integrationKey === 'string' ? integrationKey : undefined, entityType);
|
|
328
348
|
setResponseItemIds(function (currentIds) {
|
|
329
|
-
return [].concat((0, _toConsumableArray2.default)(currentIds), (0, _toConsumableArray2.default)(newIds));
|
|
349
|
+
return isDuplicateRowDeduplicationEnabled && shouldRequestFirstPage ? newIds : [].concat((0, _toConsumableArray2.default)(currentIds), (0, _toConsumableArray2.default)(newIds));
|
|
330
350
|
});
|
|
331
351
|
if (!(0, _isFedramp.isFedRamp)()) {
|
|
332
352
|
if (typeof integrationKey === 'string') {
|
|
333
|
-
aris =
|
|
334
|
-
var _item$
|
|
335
|
-
return typeof ((_item$
|
|
353
|
+
aris = itemsToAdd.reduce(function (acc, item) {
|
|
354
|
+
var _item$ari2;
|
|
355
|
+
return typeof ((_item$ari2 = item.ari) === null || _item$ari2 === void 0 ? void 0 : _item$ari2.data) === 'string' ? [].concat((0, _toConsumableArray2.default)(acc), [item.ari.data]) : acc;
|
|
336
356
|
}, []);
|
|
337
357
|
if (aris.length && entityType) {
|
|
338
358
|
discoverActions({
|
|
@@ -357,7 +377,7 @@ var useDatasourceTableState = exports.useDatasourceTableState = function useData
|
|
|
357
377
|
isUserLoadingNextPage = responseItems.length !== 0 && !shouldRequestFirstPage;
|
|
358
378
|
if (isUserLoadingNextPage) {
|
|
359
379
|
currentLoadedItemCount = responseItems.length;
|
|
360
|
-
newlyLoadedItemCount =
|
|
380
|
+
newlyLoadedItemCount = itemsToAdd.length;
|
|
361
381
|
fireEvent('track.nextItem.loaded', {
|
|
362
382
|
extensionKey: _extensionKey,
|
|
363
383
|
destinationObjectTypes: _destinationObjectTypes,
|
|
@@ -399,6 +419,7 @@ var useDatasourceTableState = exports.useDatasourceTableState = function useData
|
|
|
399
419
|
}, _callee2, null, [[2, 6]]);
|
|
400
420
|
})), [captureError, parameters, fieldKeys, nextCursor, responseItems, setResponseItemIds, onAddItems, getDatasourceData, datasourceId, applySchemaProperties, fireEvent, fullSchema, initialEmptyArray, discoverActions, isInPDFRender]);
|
|
401
421
|
var reset = (0, _react.useCallback)(function (options) {
|
|
422
|
+
responseItemAris.current.clear();
|
|
402
423
|
setResponseItems(initialEmptyArray);
|
|
403
424
|
setResponseItemIds(initialEmptyArray);
|
|
404
425
|
setHasNextPage(true);
|
|
@@ -2,6 +2,7 @@ import { useCallback, useEffect, useRef, useState } from 'react';
|
|
|
2
2
|
import isEqual from 'lodash/isEqual';
|
|
3
3
|
import { isFedRamp } from '@atlaskit/atlassian-context/is-fedramp';
|
|
4
4
|
import { DEFAULT_GET_DATASOURCE_DATA_PAGE_SIZE, useDatasourceClientExtension } from '@atlaskit/link-client-extension/use-data-source-client-extension';
|
|
5
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
5
6
|
import { useDatasourceAnalyticsEvents } from '../analytics';
|
|
6
7
|
import { useDatasourceActions } from '../state';
|
|
7
8
|
import { useDiscoverActions } from '../state/actions/useDiscoverActions';
|
|
@@ -52,6 +53,7 @@ export const useDatasourceTableState = ({
|
|
|
52
53
|
const [extensionKey, setExtensionKey] = useState();
|
|
53
54
|
const [providerName, setProviderName] = useState(undefined);
|
|
54
55
|
const abortController = useRef(new AbortController());
|
|
56
|
+
const responseItemAris = useRef(new Set());
|
|
55
57
|
const {
|
|
56
58
|
getDatasourceData,
|
|
57
59
|
getDatasourceDetails
|
|
@@ -192,11 +194,27 @@ export const useDatasourceTableState = ({
|
|
|
192
194
|
setDestinationObjectTypes(destinationObjectTypes);
|
|
193
195
|
setTotalCount(totalCount);
|
|
194
196
|
setNextCursor(nextPageCursor);
|
|
197
|
+
const isDuplicateRowDeduplicationEnabled = fg('platform_sllv_duplicated_row');
|
|
198
|
+
if (shouldRequestFirstPage && isDuplicateRowDeduplicationEnabled) {
|
|
199
|
+
responseItemAris.current.clear();
|
|
200
|
+
}
|
|
201
|
+
const itemsToAdd = isDuplicateRowDeduplicationEnabled ? items.filter(item => {
|
|
202
|
+
var _item$ari;
|
|
203
|
+
const ari = (_item$ari = item.ari) === null || _item$ari === void 0 ? void 0 : _item$ari.data;
|
|
204
|
+
if (typeof ari !== 'string') {
|
|
205
|
+
return true;
|
|
206
|
+
}
|
|
207
|
+
if (responseItemAris.current.has(ari)) {
|
|
208
|
+
return false;
|
|
209
|
+
}
|
|
210
|
+
responseItemAris.current.add(ari);
|
|
211
|
+
return true;
|
|
212
|
+
}) : items;
|
|
195
213
|
setResponseItems(currentResponseItems => {
|
|
196
214
|
if (shouldRequestFirstPage) {
|
|
197
|
-
return
|
|
215
|
+
return itemsToAdd;
|
|
198
216
|
}
|
|
199
|
-
return [...currentResponseItems, ...
|
|
217
|
+
return [...currentResponseItems, ...itemsToAdd];
|
|
200
218
|
});
|
|
201
219
|
|
|
202
220
|
/**
|
|
@@ -208,13 +226,13 @@ export const useDatasourceTableState = ({
|
|
|
208
226
|
* When `entityType` is undefined, we should not discover actions it prevents unnecessary requests to Actions service
|
|
209
227
|
*/
|
|
210
228
|
const entityType = objectTypesEntity;
|
|
211
|
-
const newIds = onAddItems(
|
|
212
|
-
setResponseItemIds(currentIds => [...currentIds, ...newIds]);
|
|
229
|
+
const newIds = onAddItems(itemsToAdd, typeof integrationKey === 'string' ? integrationKey : undefined, entityType);
|
|
230
|
+
setResponseItemIds(currentIds => isDuplicateRowDeduplicationEnabled && shouldRequestFirstPage ? newIds : [...currentIds, ...newIds]);
|
|
213
231
|
if (!isFedRamp()) {
|
|
214
232
|
if (typeof integrationKey === 'string') {
|
|
215
|
-
const aris =
|
|
216
|
-
var _item$
|
|
217
|
-
return typeof ((_item$
|
|
233
|
+
const aris = itemsToAdd.reduce((acc, item) => {
|
|
234
|
+
var _item$ari2;
|
|
235
|
+
return typeof ((_item$ari2 = item.ari) === null || _item$ari2 === void 0 ? void 0 : _item$ari2.data) === 'string' ? [...acc, item.ari.data] : acc;
|
|
218
236
|
}, []);
|
|
219
237
|
if (aris.length && entityType) {
|
|
220
238
|
discoverActions({
|
|
@@ -239,7 +257,7 @@ export const useDatasourceTableState = ({
|
|
|
239
257
|
const isUserLoadingNextPage = responseItems.length !== 0 && !shouldRequestFirstPage;
|
|
240
258
|
if (isUserLoadingNextPage) {
|
|
241
259
|
const currentLoadedItemCount = responseItems.length;
|
|
242
|
-
const newlyLoadedItemCount =
|
|
260
|
+
const newlyLoadedItemCount = itemsToAdd.length;
|
|
243
261
|
fireEvent('track.nextItem.loaded', {
|
|
244
262
|
extensionKey,
|
|
245
263
|
destinationObjectTypes,
|
|
@@ -270,6 +288,7 @@ export const useDatasourceTableState = ({
|
|
|
270
288
|
}
|
|
271
289
|
}, [captureError, parameters, fieldKeys, nextCursor, responseItems, setResponseItemIds, onAddItems, getDatasourceData, datasourceId, applySchemaProperties, fireEvent, fullSchema, initialEmptyArray, discoverActions, isInPDFRender]);
|
|
272
290
|
const reset = useCallback(options => {
|
|
291
|
+
responseItemAris.current.clear();
|
|
273
292
|
setResponseItems(initialEmptyArray);
|
|
274
293
|
setResponseItemIds(initialEmptyArray);
|
|
275
294
|
setHasNextPage(true);
|
|
@@ -6,6 +6,7 @@ import { useCallback, useEffect, useRef, useState } from 'react';
|
|
|
6
6
|
import isEqual from 'lodash/isEqual';
|
|
7
7
|
import { isFedRamp } from '@atlaskit/atlassian-context/is-fedramp';
|
|
8
8
|
import { DEFAULT_GET_DATASOURCE_DATA_PAGE_SIZE, useDatasourceClientExtension } from '@atlaskit/link-client-extension/use-data-source-client-extension';
|
|
9
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
9
10
|
import { useDatasourceAnalyticsEvents } from '../analytics';
|
|
10
11
|
import { useDatasourceActions } from '../state';
|
|
11
12
|
import { useDiscoverActions } from '../state/actions/useDiscoverActions';
|
|
@@ -99,6 +100,7 @@ export var useDatasourceTableState = function useDatasourceTableState(_ref) {
|
|
|
99
100
|
providerName = _useState30[0],
|
|
100
101
|
setProviderName = _useState30[1];
|
|
101
102
|
var abortController = useRef(new AbortController());
|
|
103
|
+
var responseItemAris = useRef(new Set());
|
|
102
104
|
var _useDatasourceClientE = useDatasourceClientExtension(),
|
|
103
105
|
getDatasourceData = _useDatasourceClientE.getDatasourceData,
|
|
104
106
|
getDatasourceDetails = _useDatasourceClientE.getDatasourceDetails;
|
|
@@ -227,6 +229,8 @@ export var useDatasourceTableState = function useDatasourceTableState(_ref) {
|
|
|
227
229
|
nextPageCursor,
|
|
228
230
|
_totalCount,
|
|
229
231
|
schema,
|
|
232
|
+
isDuplicateRowDeduplicationEnabled,
|
|
233
|
+
itemsToAdd,
|
|
230
234
|
integrationKey,
|
|
231
235
|
entityType,
|
|
232
236
|
newIds,
|
|
@@ -302,11 +306,27 @@ export var useDatasourceTableState = function useDatasourceTableState(_ref) {
|
|
|
302
306
|
setDestinationObjectTypes(_destinationObjectTypes);
|
|
303
307
|
setTotalCount(_totalCount);
|
|
304
308
|
setNextCursor(nextPageCursor);
|
|
309
|
+
isDuplicateRowDeduplicationEnabled = fg('platform_sllv_duplicated_row');
|
|
310
|
+
if (shouldRequestFirstPage && isDuplicateRowDeduplicationEnabled) {
|
|
311
|
+
responseItemAris.current.clear();
|
|
312
|
+
}
|
|
313
|
+
itemsToAdd = isDuplicateRowDeduplicationEnabled ? items.filter(function (item) {
|
|
314
|
+
var _item$ari;
|
|
315
|
+
var ari = (_item$ari = item.ari) === null || _item$ari === void 0 ? void 0 : _item$ari.data;
|
|
316
|
+
if (typeof ari !== 'string') {
|
|
317
|
+
return true;
|
|
318
|
+
}
|
|
319
|
+
if (responseItemAris.current.has(ari)) {
|
|
320
|
+
return false;
|
|
321
|
+
}
|
|
322
|
+
responseItemAris.current.add(ari);
|
|
323
|
+
return true;
|
|
324
|
+
}) : items;
|
|
305
325
|
setResponseItems(function (currentResponseItems) {
|
|
306
326
|
if (shouldRequestFirstPage) {
|
|
307
|
-
return
|
|
327
|
+
return itemsToAdd;
|
|
308
328
|
}
|
|
309
|
-
return [].concat(_toConsumableArray(currentResponseItems), _toConsumableArray(
|
|
329
|
+
return [].concat(_toConsumableArray(currentResponseItems), _toConsumableArray(itemsToAdd));
|
|
310
330
|
});
|
|
311
331
|
|
|
312
332
|
/**
|
|
@@ -317,15 +337,15 @@ export var useDatasourceTableState = function useDatasourceTableState(_ref) {
|
|
|
317
337
|
* When `entityType` is undefined, we should not discover actions it prevents unnecessary requests to Actions service
|
|
318
338
|
*/
|
|
319
339
|
entityType = objectTypesEntity;
|
|
320
|
-
newIds = onAddItems(
|
|
340
|
+
newIds = onAddItems(itemsToAdd, typeof integrationKey === 'string' ? integrationKey : undefined, entityType);
|
|
321
341
|
setResponseItemIds(function (currentIds) {
|
|
322
|
-
return [].concat(_toConsumableArray(currentIds), _toConsumableArray(newIds));
|
|
342
|
+
return isDuplicateRowDeduplicationEnabled && shouldRequestFirstPage ? newIds : [].concat(_toConsumableArray(currentIds), _toConsumableArray(newIds));
|
|
323
343
|
});
|
|
324
344
|
if (!isFedRamp()) {
|
|
325
345
|
if (typeof integrationKey === 'string') {
|
|
326
|
-
aris =
|
|
327
|
-
var _item$
|
|
328
|
-
return typeof ((_item$
|
|
346
|
+
aris = itemsToAdd.reduce(function (acc, item) {
|
|
347
|
+
var _item$ari2;
|
|
348
|
+
return typeof ((_item$ari2 = item.ari) === null || _item$ari2 === void 0 ? void 0 : _item$ari2.data) === 'string' ? [].concat(_toConsumableArray(acc), [item.ari.data]) : acc;
|
|
329
349
|
}, []);
|
|
330
350
|
if (aris.length && entityType) {
|
|
331
351
|
discoverActions({
|
|
@@ -350,7 +370,7 @@ export var useDatasourceTableState = function useDatasourceTableState(_ref) {
|
|
|
350
370
|
isUserLoadingNextPage = responseItems.length !== 0 && !shouldRequestFirstPage;
|
|
351
371
|
if (isUserLoadingNextPage) {
|
|
352
372
|
currentLoadedItemCount = responseItems.length;
|
|
353
|
-
newlyLoadedItemCount =
|
|
373
|
+
newlyLoadedItemCount = itemsToAdd.length;
|
|
354
374
|
fireEvent('track.nextItem.loaded', {
|
|
355
375
|
extensionKey: _extensionKey,
|
|
356
376
|
destinationObjectTypes: _destinationObjectTypes,
|
|
@@ -392,6 +412,7 @@ export var useDatasourceTableState = function useDatasourceTableState(_ref) {
|
|
|
392
412
|
}, _callee2, null, [[2, 6]]);
|
|
393
413
|
})), [captureError, parameters, fieldKeys, nextCursor, responseItems, setResponseItemIds, onAddItems, getDatasourceData, datasourceId, applySchemaProperties, fireEvent, fullSchema, initialEmptyArray, discoverActions, isInPDFRender]);
|
|
394
414
|
var reset = useCallback(function (options) {
|
|
415
|
+
responseItemAris.current.clear();
|
|
395
416
|
setResponseItems(initialEmptyArray);
|
|
396
417
|
setResponseItemIds(initialEmptyArray);
|
|
397
418
|
setHasNextPage(true);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/link-datasource",
|
|
3
|
-
"version": "7.3.
|
|
3
|
+
"version": "7.3.4",
|
|
4
4
|
"description": "UI Components to support linking platform dataset feature",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -41,20 +41,20 @@
|
|
|
41
41
|
"@atlaskit/adf-schema": "^57.7.0",
|
|
42
42
|
"@atlaskit/afm-i18n-platform-linking-platform-link-datasource": "2.271.0",
|
|
43
43
|
"@atlaskit/analytics-cross-product": "^2.2.0",
|
|
44
|
-
"@atlaskit/analytics-next": "^12.
|
|
44
|
+
"@atlaskit/analytics-next": "^12.6.0",
|
|
45
45
|
"@atlaskit/atlassian-context": "^2.0.0",
|
|
46
46
|
"@atlaskit/avatar": "^30.0.0",
|
|
47
47
|
"@atlaskit/avatar-group": "^14.4.0",
|
|
48
48
|
"@atlaskit/badge": "^22.0.0",
|
|
49
49
|
"@atlaskit/button": "^25.4.0",
|
|
50
50
|
"@atlaskit/css": "^1.1.0",
|
|
51
|
-
"@atlaskit/datetime-picker": "^19.
|
|
51
|
+
"@atlaskit/datetime-picker": "^19.3.0",
|
|
52
52
|
"@atlaskit/dropdown-menu": "^21.0.0",
|
|
53
53
|
"@atlaskit/editor-prosemirror": "^9.0.0",
|
|
54
54
|
"@atlaskit/empty-state": "^12.2.0",
|
|
55
55
|
"@atlaskit/feature-gate-js-client": "^7.0.0",
|
|
56
56
|
"@atlaskit/flag": "^19.0.0",
|
|
57
|
-
"@atlaskit/form": "^18.
|
|
57
|
+
"@atlaskit/form": "^18.2.0",
|
|
58
58
|
"@atlaskit/heading": "^8.0.0",
|
|
59
59
|
"@atlaskit/icon": "^38.0.0",
|
|
60
60
|
"@atlaskit/image": "^5.2.0",
|
|
@@ -174,6 +174,9 @@
|
|
|
174
174
|
"platform_lp_sllv_table_settings_menu": {
|
|
175
175
|
"type": "boolean"
|
|
176
176
|
},
|
|
177
|
+
"platform_sllv_duplicated_row": {
|
|
178
|
+
"type": "boolean"
|
|
179
|
+
},
|
|
177
180
|
"astral_units_workspace_host_resolver": {
|
|
178
181
|
"type": "boolean"
|
|
179
182
|
},
|