@atlaskit/link-datasource 4.21.6 → 4.22.0
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 +15 -0
- package/dist/cjs/hooks/useDeepEffect.js +18 -0
- package/dist/cjs/ui/datasource-table-view/datasourceTableView.js +22 -6
- package/dist/es2019/hooks/useDeepEffect.js +11 -0
- package/dist/es2019/ui/datasource-table-view/datasourceTableView.js +22 -6
- package/dist/esm/hooks/useDeepEffect.js +11 -0
- package/dist/esm/ui/datasource-table-view/datasourceTableView.js +22 -6
- package/dist/types/hooks/useDeepEffect.d.ts +2 -0
- package/dist/types-ts4.5/hooks/useDeepEffect.d.ts +2 -0
- package/package.json +7 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/link-datasource
|
|
2
2
|
|
|
3
|
+
## 4.22.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`64ec65231b4cf`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/64ec65231b4cf) -
|
|
8
|
+
EDITOR-1568 bump adf-schema for afm
|
|
9
|
+
|
|
10
|
+
## 4.21.7
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [`ec1eda37975bf`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ec1eda37975bf) -
|
|
15
|
+
Deep comparison on DatasourceTable parameter changes before trigger reset
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 4.21.6
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.useDeepEffect = void 0;
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
|
10
|
+
var useDeepEffect = exports.useDeepEffect = function useDeepEffect(callback, dependencies) {
|
|
11
|
+
var prevDependencies = (0, _react.useRef)();
|
|
12
|
+
(0, _react.useEffect)(function () {
|
|
13
|
+
if (!(0, _isEqual.default)(dependencies, prevDependencies.current)) {
|
|
14
|
+
callback();
|
|
15
|
+
prevDependencies.current = dependencies;
|
|
16
|
+
}
|
|
17
|
+
}, [dependencies, callback]);
|
|
18
|
+
};
|
|
@@ -22,6 +22,7 @@ var _useDataRenderedUfoExperience = require("../../analytics/ufoExperiences/hook
|
|
|
22
22
|
var _fetchMessagesForLocale = require("../../common/utils/locale/fetch-messages-for-locale");
|
|
23
23
|
var _datasourceExperienceId = require("../../contexts/datasource-experience-id");
|
|
24
24
|
var _useDatasourceTableState = require("../../hooks/useDatasourceTableState");
|
|
25
|
+
var _useDeepEffect = require("../../hooks/useDeepEffect");
|
|
25
26
|
var _en = _interopRequireDefault(require("../../i18n/en"));
|
|
26
27
|
var _state = require("../../state");
|
|
27
28
|
var _assetsModal = require("../assets-modal");
|
|
@@ -80,12 +81,27 @@ var DatasourceTableViewWithoutAnalytics = function DatasourceTableViewWithoutAna
|
|
|
80
81
|
var hasColumns = !!columns.length;
|
|
81
82
|
var isDataReady = hasColumns && responseItems.length > 0 && totalCount && totalCount > 0;
|
|
82
83
|
visibleColumnCount.current = (visibleColumnKeys === null || visibleColumnKeys === void 0 ? void 0 : visibleColumnKeys.length) || 0;
|
|
83
|
-
(0,
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
84
|
+
if ((0, _platformFeatureFlags.fg)('navx-1334-datasource-deep-compare-params')) {
|
|
85
|
+
// parameters is an object that we want to track, and when something inside it changes we want to
|
|
86
|
+
// call effect callback. Normal useEffect will not do deep comparison, but only reference one.
|
|
87
|
+
// This hook will do deep comparison making sure we don’t call reset() when only reference to an object
|
|
88
|
+
// has changed but not the content.
|
|
89
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
90
|
+
(0, _useDeepEffect.useDeepEffect)(function () {
|
|
91
|
+
if (!isInitialRender.current) {
|
|
92
|
+
reset();
|
|
93
|
+
}
|
|
94
|
+
isInitialRender.current = false;
|
|
95
|
+
}, [reset, parameters]);
|
|
96
|
+
} else {
|
|
97
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
98
|
+
(0, _react.useEffect)(function () {
|
|
99
|
+
if (!isInitialRender.current) {
|
|
100
|
+
reset();
|
|
101
|
+
}
|
|
102
|
+
isInitialRender.current = false;
|
|
103
|
+
}, [reset, parameters]);
|
|
104
|
+
}
|
|
89
105
|
(0, _react.useEffect)(function () {
|
|
90
106
|
if (onVisibleColumnKeysChange && (visibleColumnKeys || []).length === 0 && defaultVisibleColumnKeys.length > 0) {
|
|
91
107
|
onVisibleColumnKeysChange(defaultVisibleColumnKeys);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useEffect, useRef } from 'react';
|
|
2
|
+
import isEqual from 'lodash/isEqual';
|
|
3
|
+
export const useDeepEffect = (callback, dependencies) => {
|
|
4
|
+
const prevDependencies = useRef();
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
if (!isEqual(dependencies, prevDependencies.current)) {
|
|
7
|
+
callback();
|
|
8
|
+
prevDependencies.current = dependencies;
|
|
9
|
+
}
|
|
10
|
+
}, [dependencies, callback]);
|
|
11
|
+
};
|
|
@@ -14,6 +14,7 @@ import { useDataRenderedUfoExperience } from '../../analytics/ufoExperiences/hoo
|
|
|
14
14
|
import { fetchMessagesForLocale } from '../../common/utils/locale/fetch-messages-for-locale';
|
|
15
15
|
import { DatasourceExperienceIdProvider, useDatasourceExperienceId } from '../../contexts/datasource-experience-id';
|
|
16
16
|
import { useDatasourceTableState } from '../../hooks/useDatasourceTableState';
|
|
17
|
+
import { useDeepEffect } from '../../hooks/useDeepEffect';
|
|
17
18
|
import i18nEN from '../../i18n/en';
|
|
18
19
|
import { StoreContainer } from '../../state';
|
|
19
20
|
import { ASSETS_LIST_OF_LINKS_DATASOURCE_ID } from '../assets-modal';
|
|
@@ -72,12 +73,27 @@ const DatasourceTableViewWithoutAnalytics = ({
|
|
|
72
73
|
const hasColumns = !!columns.length;
|
|
73
74
|
const isDataReady = hasColumns && responseItems.length > 0 && totalCount && totalCount > 0;
|
|
74
75
|
visibleColumnCount.current = (visibleColumnKeys === null || visibleColumnKeys === void 0 ? void 0 : visibleColumnKeys.length) || 0;
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
76
|
+
if (fg('navx-1334-datasource-deep-compare-params')) {
|
|
77
|
+
// parameters is an object that we want to track, and when something inside it changes we want to
|
|
78
|
+
// call effect callback. Normal useEffect will not do deep comparison, but only reference one.
|
|
79
|
+
// This hook will do deep comparison making sure we don’t call reset() when only reference to an object
|
|
80
|
+
// has changed but not the content.
|
|
81
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
82
|
+
useDeepEffect(() => {
|
|
83
|
+
if (!isInitialRender.current) {
|
|
84
|
+
reset();
|
|
85
|
+
}
|
|
86
|
+
isInitialRender.current = false;
|
|
87
|
+
}, [reset, parameters]);
|
|
88
|
+
} else {
|
|
89
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
90
|
+
useEffect(() => {
|
|
91
|
+
if (!isInitialRender.current) {
|
|
92
|
+
reset();
|
|
93
|
+
}
|
|
94
|
+
isInitialRender.current = false;
|
|
95
|
+
}, [reset, parameters]);
|
|
96
|
+
}
|
|
81
97
|
useEffect(() => {
|
|
82
98
|
if (onVisibleColumnKeysChange && (visibleColumnKeys || []).length === 0 && defaultVisibleColumnKeys.length > 0) {
|
|
83
99
|
onVisibleColumnKeysChange(defaultVisibleColumnKeys);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useEffect, useRef } from 'react';
|
|
2
|
+
import isEqual from 'lodash/isEqual';
|
|
3
|
+
export var useDeepEffect = function useDeepEffect(callback, dependencies) {
|
|
4
|
+
var prevDependencies = useRef();
|
|
5
|
+
useEffect(function () {
|
|
6
|
+
if (!isEqual(dependencies, prevDependencies.current)) {
|
|
7
|
+
callback();
|
|
8
|
+
prevDependencies.current = dependencies;
|
|
9
|
+
}
|
|
10
|
+
}, [dependencies, callback]);
|
|
11
|
+
};
|
|
@@ -14,6 +14,7 @@ import { useDataRenderedUfoExperience } from '../../analytics/ufoExperiences/hoo
|
|
|
14
14
|
import { fetchMessagesForLocale } from '../../common/utils/locale/fetch-messages-for-locale';
|
|
15
15
|
import { DatasourceExperienceIdProvider, useDatasourceExperienceId } from '../../contexts/datasource-experience-id';
|
|
16
16
|
import { useDatasourceTableState } from '../../hooks/useDatasourceTableState';
|
|
17
|
+
import { useDeepEffect } from '../../hooks/useDeepEffect';
|
|
17
18
|
import i18nEN from '../../i18n/en';
|
|
18
19
|
import { StoreContainer } from '../../state';
|
|
19
20
|
import { ASSETS_LIST_OF_LINKS_DATASOURCE_ID } from '../assets-modal';
|
|
@@ -71,12 +72,27 @@ var DatasourceTableViewWithoutAnalytics = function DatasourceTableViewWithoutAna
|
|
|
71
72
|
var hasColumns = !!columns.length;
|
|
72
73
|
var isDataReady = hasColumns && responseItems.length > 0 && totalCount && totalCount > 0;
|
|
73
74
|
visibleColumnCount.current = (visibleColumnKeys === null || visibleColumnKeys === void 0 ? void 0 : visibleColumnKeys.length) || 0;
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
75
|
+
if (fg('navx-1334-datasource-deep-compare-params')) {
|
|
76
|
+
// parameters is an object that we want to track, and when something inside it changes we want to
|
|
77
|
+
// call effect callback. Normal useEffect will not do deep comparison, but only reference one.
|
|
78
|
+
// This hook will do deep comparison making sure we don’t call reset() when only reference to an object
|
|
79
|
+
// has changed but not the content.
|
|
80
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
81
|
+
useDeepEffect(function () {
|
|
82
|
+
if (!isInitialRender.current) {
|
|
83
|
+
reset();
|
|
84
|
+
}
|
|
85
|
+
isInitialRender.current = false;
|
|
86
|
+
}, [reset, parameters]);
|
|
87
|
+
} else {
|
|
88
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
89
|
+
useEffect(function () {
|
|
90
|
+
if (!isInitialRender.current) {
|
|
91
|
+
reset();
|
|
92
|
+
}
|
|
93
|
+
isInitialRender.current = false;
|
|
94
|
+
}, [reset, parameters]);
|
|
95
|
+
}
|
|
80
96
|
useEffect(function () {
|
|
81
97
|
if (onVisibleColumnKeysChange && (visibleColumnKeys || []).length === 0 && defaultVisibleColumnKeys.length > 0) {
|
|
82
98
|
onVisibleColumnKeysChange(defaultVisibleColumnKeys);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/link-datasource",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.22.0",
|
|
4
4
|
"description": "UI Components to support linking platform dataset feature",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"ak-postbuild": "ls -d dist/* | xargs -n 1 copyfiles -u 1 -V src/**/*.{svg,png}"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@atlaskit/adf-schema": "^51.
|
|
39
|
+
"@atlaskit/adf-schema": "^51.1.1",
|
|
40
40
|
"@atlaskit/analytics-next": "^11.1.0",
|
|
41
41
|
"@atlaskit/atlassian-context": "^0.5.0",
|
|
42
42
|
"@atlaskit/avatar": "^25.1.0",
|
|
@@ -78,12 +78,12 @@
|
|
|
78
78
|
"@atlaskit/primitives": "^14.14.0",
|
|
79
79
|
"@atlaskit/react-select": "^3.5.0",
|
|
80
80
|
"@atlaskit/select": "^21.2.0",
|
|
81
|
-
"@atlaskit/smart-card": "^40.
|
|
81
|
+
"@atlaskit/smart-card": "^40.22.0",
|
|
82
82
|
"@atlaskit/smart-user-picker": "^8.2.0",
|
|
83
83
|
"@atlaskit/spinner": "^19.0.0",
|
|
84
84
|
"@atlaskit/tag": "^14.1.0",
|
|
85
85
|
"@atlaskit/textfield": "^8.0.0",
|
|
86
|
-
"@atlaskit/theme": "^
|
|
86
|
+
"@atlaskit/theme": "^21.0.0",
|
|
87
87
|
"@atlaskit/tokens": "^6.3.0",
|
|
88
88
|
"@atlaskit/tooltip": "^20.4.0",
|
|
89
89
|
"@atlaskit/ufo": "^0.4.0",
|
|
@@ -184,6 +184,9 @@
|
|
|
184
184
|
},
|
|
185
185
|
"navx-1483-a11y-close-button-in-modal-updates": {
|
|
186
186
|
"type": "boolean"
|
|
187
|
+
},
|
|
188
|
+
"navx-1334-datasource-deep-compare-params": {
|
|
189
|
+
"type": "boolean"
|
|
187
190
|
}
|
|
188
191
|
},
|
|
189
192
|
"compassUnitTestMetricSourceId": "ari:cloud:compass:a436116f-02ce-4520-8fbb-7301462a1674:metric-source/c5751cc6-3513-4070-9deb-af31e86aed34/9c893299-a527-4457-9b46-f3bc4c828766"
|