@atlaskit/link-datasource 1.19.34 → 1.19.35
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 +6 -0
- package/dist/cjs/hooks/useDatasourceTableState.js +17 -8
- package/dist/es2019/hooks/useDatasourceTableState.js +14 -8
- package/dist/esm/hooks/useDatasourceTableState.js +17 -8
- package/dist/types/hooks/useDatasourceTableState.d.ts +2 -0
- package/dist/types-ts4.5/hooks/useDatasourceTableState.d.ts +2 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/link-datasource
|
|
2
2
|
|
|
3
|
+
## 1.19.35
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#63616](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/63616) [`01ee02f34d54`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/01ee02f34d54) - Fixes issue duplication in list of links after adding columns through the config modal.
|
|
8
|
+
|
|
3
9
|
## 1.19.34
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -308,18 +308,26 @@ var useDatasourceTableState = exports.useDatasourceTableState = function useData
|
|
|
308
308
|
}
|
|
309
309
|
}, _callee2, null, [[7, 39]]);
|
|
310
310
|
})), [captureError, parameters, fieldKeys, nextCursor, getDatasourceData, datasourceId, responseItems === null || responseItems === void 0 ? void 0 : responseItems.length, applySchemaProperties, fireEvent, fullSchema]);
|
|
311
|
-
var reset = (0, _react.useCallback)(function (
|
|
311
|
+
var reset = (0, _react.useCallback)(function () {
|
|
312
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
313
|
+
var _ref4 = options,
|
|
314
|
+
_ref4$shouldResetFull = _ref4.shouldResetFullSchema,
|
|
315
|
+
shouldResetFullSchema = _ref4$shouldResetFull === void 0 ? true : _ref4$shouldResetFull,
|
|
316
|
+
_ref4$shouldForceRequ = _ref4.shouldForceRequest,
|
|
317
|
+
shouldForceRequest = _ref4$shouldForceRequ === void 0 ? false : _ref4$shouldForceRequ,
|
|
318
|
+
_ref4$shouldResetColu = _ref4.shouldResetColumns,
|
|
319
|
+
shouldResetColumns = _ref4$shouldResetColu === void 0 ? false : _ref4$shouldResetColu;
|
|
312
320
|
setStatus('empty');
|
|
313
321
|
setResponseItems([]);
|
|
314
322
|
setHasNextPage(true);
|
|
315
323
|
setNextCursor(undefined);
|
|
316
324
|
setTotalCount(undefined);
|
|
317
325
|
setLastRequestedFieldKeys([]);
|
|
318
|
-
setFullSchema({
|
|
326
|
+
shouldResetFullSchema && setFullSchema({
|
|
319
327
|
properties: []
|
|
320
328
|
});
|
|
321
|
-
setShouldForceRequest(
|
|
322
|
-
if (
|
|
329
|
+
setShouldForceRequest(shouldForceRequest);
|
|
330
|
+
if (shouldResetColumns) {
|
|
323
331
|
setColumns([]);
|
|
324
332
|
setDefaultVisibleColumnKeys([]);
|
|
325
333
|
}
|
|
@@ -354,11 +362,12 @@ var useDatasourceTableState = exports.useDatasourceTableState = function useData
|
|
|
354
362
|
return responseItemKeys.includes(key);
|
|
355
363
|
});
|
|
356
364
|
});
|
|
365
|
+
|
|
366
|
+
// if there is no data for the new columns, resetting the state triggers the request of new data (onNextPage)
|
|
367
|
+
// but the schema should not be reset as it is already loaded
|
|
357
368
|
if (!hasDataForColumns) {
|
|
358
|
-
reset(
|
|
359
|
-
|
|
360
|
-
isSchemaFromData: false,
|
|
361
|
-
shouldRequestFirstPage: true
|
|
369
|
+
reset({
|
|
370
|
+
shouldResetFullSchema: false
|
|
362
371
|
});
|
|
363
372
|
}
|
|
364
373
|
}
|
|
@@ -189,18 +189,23 @@ export const useDatasourceTableState = ({
|
|
|
189
189
|
setStatus('rejected');
|
|
190
190
|
}
|
|
191
191
|
}, [captureError, parameters, fieldKeys, nextCursor, getDatasourceData, datasourceId, responseItems === null || responseItems === void 0 ? void 0 : responseItems.length, applySchemaProperties, fireEvent, fullSchema]);
|
|
192
|
-
const reset = useCallback(options => {
|
|
192
|
+
const reset = useCallback((options = {}) => {
|
|
193
|
+
const {
|
|
194
|
+
shouldResetFullSchema = true,
|
|
195
|
+
shouldForceRequest = false,
|
|
196
|
+
shouldResetColumns = false
|
|
197
|
+
} = options;
|
|
193
198
|
setStatus('empty');
|
|
194
199
|
setResponseItems([]);
|
|
195
200
|
setHasNextPage(true);
|
|
196
201
|
setNextCursor(undefined);
|
|
197
202
|
setTotalCount(undefined);
|
|
198
203
|
setLastRequestedFieldKeys([]);
|
|
199
|
-
setFullSchema({
|
|
204
|
+
shouldResetFullSchema && setFullSchema({
|
|
200
205
|
properties: []
|
|
201
206
|
});
|
|
202
|
-
setShouldForceRequest(
|
|
203
|
-
if (
|
|
207
|
+
setShouldForceRequest(shouldForceRequest);
|
|
208
|
+
if (shouldResetColumns) {
|
|
204
209
|
setColumns([]);
|
|
205
210
|
setDefaultVisibleColumnKeys([]);
|
|
206
211
|
}
|
|
@@ -231,11 +236,12 @@ export const useDatasourceTableState = ({
|
|
|
231
236
|
const responseItemKeys = Object.keys(responseItem);
|
|
232
237
|
return fieldKeys.every(key => responseItemKeys.includes(key));
|
|
233
238
|
});
|
|
239
|
+
|
|
240
|
+
// if there is no data for the new columns, resetting the state triggers the request of new data (onNextPage)
|
|
241
|
+
// but the schema should not be reset as it is already loaded
|
|
234
242
|
if (!hasDataForColumns) {
|
|
235
|
-
reset(
|
|
236
|
-
|
|
237
|
-
isSchemaFromData: false,
|
|
238
|
-
shouldRequestFirstPage: true
|
|
243
|
+
reset({
|
|
244
|
+
shouldResetFullSchema: false
|
|
239
245
|
});
|
|
240
246
|
}
|
|
241
247
|
}
|
|
@@ -301,18 +301,26 @@ export var useDatasourceTableState = function useDatasourceTableState(_ref) {
|
|
|
301
301
|
}
|
|
302
302
|
}, _callee2, null, [[7, 39]]);
|
|
303
303
|
})), [captureError, parameters, fieldKeys, nextCursor, getDatasourceData, datasourceId, responseItems === null || responseItems === void 0 ? void 0 : responseItems.length, applySchemaProperties, fireEvent, fullSchema]);
|
|
304
|
-
var reset = useCallback(function (
|
|
304
|
+
var reset = useCallback(function () {
|
|
305
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
306
|
+
var _ref4 = options,
|
|
307
|
+
_ref4$shouldResetFull = _ref4.shouldResetFullSchema,
|
|
308
|
+
shouldResetFullSchema = _ref4$shouldResetFull === void 0 ? true : _ref4$shouldResetFull,
|
|
309
|
+
_ref4$shouldForceRequ = _ref4.shouldForceRequest,
|
|
310
|
+
shouldForceRequest = _ref4$shouldForceRequ === void 0 ? false : _ref4$shouldForceRequ,
|
|
311
|
+
_ref4$shouldResetColu = _ref4.shouldResetColumns,
|
|
312
|
+
shouldResetColumns = _ref4$shouldResetColu === void 0 ? false : _ref4$shouldResetColu;
|
|
305
313
|
setStatus('empty');
|
|
306
314
|
setResponseItems([]);
|
|
307
315
|
setHasNextPage(true);
|
|
308
316
|
setNextCursor(undefined);
|
|
309
317
|
setTotalCount(undefined);
|
|
310
318
|
setLastRequestedFieldKeys([]);
|
|
311
|
-
setFullSchema({
|
|
319
|
+
shouldResetFullSchema && setFullSchema({
|
|
312
320
|
properties: []
|
|
313
321
|
});
|
|
314
|
-
setShouldForceRequest(
|
|
315
|
-
if (
|
|
322
|
+
setShouldForceRequest(shouldForceRequest);
|
|
323
|
+
if (shouldResetColumns) {
|
|
316
324
|
setColumns([]);
|
|
317
325
|
setDefaultVisibleColumnKeys([]);
|
|
318
326
|
}
|
|
@@ -347,11 +355,12 @@ export var useDatasourceTableState = function useDatasourceTableState(_ref) {
|
|
|
347
355
|
return responseItemKeys.includes(key);
|
|
348
356
|
});
|
|
349
357
|
});
|
|
358
|
+
|
|
359
|
+
// if there is no data for the new columns, resetting the state triggers the request of new data (onNextPage)
|
|
360
|
+
// but the schema should not be reset as it is already loaded
|
|
350
361
|
if (!hasDataForColumns) {
|
|
351
|
-
reset(
|
|
352
|
-
|
|
353
|
-
isSchemaFromData: false,
|
|
354
|
-
shouldRequestFirstPage: true
|
|
362
|
+
reset({
|
|
363
|
+
shouldResetFullSchema: false
|
|
355
364
|
});
|
|
356
365
|
}
|
|
357
366
|
}
|
|
@@ -10,6 +10,8 @@ interface ResetOptions {
|
|
|
10
10
|
shouldForceRequest?: boolean;
|
|
11
11
|
/** Resets current column data from a datasource table when issuing the new request */
|
|
12
12
|
shouldResetColumns?: boolean;
|
|
13
|
+
/** Resets current schema data from a datasource table when issuing the new request */
|
|
14
|
+
shouldResetFullSchema?: boolean;
|
|
13
15
|
}
|
|
14
16
|
export interface DatasourceTableState {
|
|
15
17
|
/** The current status of the table for rendering of the different UI states (e.g.: loading, error, etc). */
|
|
@@ -10,6 +10,8 @@ interface ResetOptions {
|
|
|
10
10
|
shouldForceRequest?: boolean;
|
|
11
11
|
/** Resets current column data from a datasource table when issuing the new request */
|
|
12
12
|
shouldResetColumns?: boolean;
|
|
13
|
+
/** Resets current schema data from a datasource table when issuing the new request */
|
|
14
|
+
shouldResetFullSchema?: boolean;
|
|
13
15
|
}
|
|
14
16
|
export interface DatasourceTableState {
|
|
15
17
|
/** The current status of the table for rendering of the different UI states (e.g.: loading, error, etc). */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/link-datasource",
|
|
3
|
-
"version": "1.19.
|
|
3
|
+
"version": "1.19.35",
|
|
4
4
|
"description": "UI Components to support linking platform dataset feature",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"@atlaskit/tag": "^12.0.0",
|
|
63
63
|
"@atlaskit/textfield": "6.0.0",
|
|
64
64
|
"@atlaskit/theme": "^12.6.0",
|
|
65
|
-
"@atlaskit/tokens": "^1.
|
|
65
|
+
"@atlaskit/tokens": "^1.32.0",
|
|
66
66
|
"@atlaskit/tooltip": "^18.1.0",
|
|
67
67
|
"@atlaskit/ufo": "^0.2.4",
|
|
68
68
|
"@atlassianlabs/jql-editor": "^2.0.1",
|