@atlaskit/link-create 1.8.1 → 1.9.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 +10 -0
- package/dist/cjs/ui/link-create/main.js +21 -1
- package/dist/cjs/ui/main.js +1 -1
- package/dist/es2019/ui/link-create/main.js +18 -1
- package/dist/es2019/ui/main.js +1 -1
- package/dist/esm/ui/link-create/main.js +22 -2
- package/dist/esm/ui/main.js +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @atlaskit/link-create
|
|
2
2
|
|
|
3
|
+
## 1.9.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#43068](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/43068) [`76817bfbd5d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/76817bfbd5d) - EDM-8402: under a FF platform.linking-platform.link-create.enable-edit internally refactor onCloseComplete hook to be conditionally called when active prop is false
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
3
13
|
## 1.8.1
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
@@ -133,6 +133,17 @@ var LinkCreateWithModal = function LinkCreateWithModal(_ref3) {
|
|
|
133
133
|
};
|
|
134
134
|
var LinkCreateModal = function LinkCreateModal(props) {
|
|
135
135
|
if ((0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.link-create.enable-edit')) {
|
|
136
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
137
|
+
var shouldCallCloseComplete = (0, _react.useRef)(!props.active);
|
|
138
|
+
|
|
139
|
+
// modal calls onCloseComplete in a useEffect(), so we can track whether
|
|
140
|
+
// or not we should execute it based on the active prop in a
|
|
141
|
+
// useLayoutEffect() which will be run before child useEffect()s
|
|
142
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
143
|
+
(0, _react.useLayoutEffect)(function () {
|
|
144
|
+
// onCloseComplete should only be called when it is not active
|
|
145
|
+
shouldCallCloseComplete.current = !props.active;
|
|
146
|
+
}, [props.active]);
|
|
136
147
|
return (0, _react2.jsx)(_pluginContext.LinkCreatePluginsProvider, {
|
|
137
148
|
plugins: props.plugins,
|
|
138
149
|
entityKey: props.entityKey
|
|
@@ -177,7 +188,16 @@ var LinkCreateModal = function LinkCreateModal(props) {
|
|
|
177
188
|
return function (_x2) {
|
|
178
189
|
return _ref6.apply(this, arguments);
|
|
179
190
|
};
|
|
180
|
-
}()
|
|
191
|
+
}(),
|
|
192
|
+
onCloseComplete: function onCloseComplete() {
|
|
193
|
+
if (shouldCallCloseComplete.current) {
|
|
194
|
+
var _props$onCloseComplet;
|
|
195
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
196
|
+
args[_key] = arguments[_key];
|
|
197
|
+
}
|
|
198
|
+
(_props$onCloseComplet = props.onCloseComplete) === null || _props$onCloseComplet === void 0 || _props$onCloseComplet.call.apply(_props$onCloseComplet, [props].concat(args));
|
|
199
|
+
}
|
|
200
|
+
}
|
|
181
201
|
}))));
|
|
182
202
|
});
|
|
183
203
|
});
|
package/dist/cjs/ui/main.js
CHANGED
|
@@ -35,7 +35,7 @@ var LinkCreateWithAnalyticsContext = (0, _analytics.withLinkCreateAnalyticsConte
|
|
|
35
35
|
}));
|
|
36
36
|
var PACKAGE_DATA = exports.PACKAGE_DATA = {
|
|
37
37
|
packageName: "@atlaskit/link-create" || '',
|
|
38
|
-
packageVersion: "1.
|
|
38
|
+
packageVersion: "1.9.0" || '',
|
|
39
39
|
componentName: _constants.COMPONENT_NAME,
|
|
40
40
|
source: _constants.COMPONENT_NAME
|
|
41
41
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
/** @jsx jsx */
|
|
3
|
-
import { Fragment, useCallback, useState } from 'react';
|
|
3
|
+
import { Fragment, useCallback, useLayoutEffect, useRef, useState } from 'react';
|
|
4
4
|
import { jsx } from '@emotion/react';
|
|
5
5
|
import { useIntl } from 'react-intl-next';
|
|
6
6
|
import Modal, { ModalBody, ModalHeader, ModalTitle, ModalTransition } from '@atlaskit/modal-dialog';
|
|
@@ -98,6 +98,17 @@ const LinkCreateWithModal = ({
|
|
|
98
98
|
};
|
|
99
99
|
const LinkCreateModal = props => {
|
|
100
100
|
if (getBooleanFF('platform.linking-platform.link-create.enable-edit')) {
|
|
101
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
102
|
+
const shouldCallCloseComplete = useRef(!props.active);
|
|
103
|
+
|
|
104
|
+
// modal calls onCloseComplete in a useEffect(), so we can track whether
|
|
105
|
+
// or not we should execute it based on the active prop in a
|
|
106
|
+
// useLayoutEffect() which will be run before child useEffect()s
|
|
107
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
108
|
+
useLayoutEffect(() => {
|
|
109
|
+
// onCloseComplete should only be called when it is not active
|
|
110
|
+
shouldCallCloseComplete.current = !props.active;
|
|
111
|
+
}, [props.active]);
|
|
101
112
|
return jsx(LinkCreatePluginsProvider, {
|
|
102
113
|
plugins: props.plugins,
|
|
103
114
|
entityKey: props.entityKey
|
|
@@ -128,6 +139,12 @@ const LinkCreateModal = props => {
|
|
|
128
139
|
props.onComplete();
|
|
129
140
|
}
|
|
130
141
|
}
|
|
142
|
+
},
|
|
143
|
+
onCloseComplete: (...args) => {
|
|
144
|
+
if (shouldCallCloseComplete.current) {
|
|
145
|
+
var _props$onCloseComplet;
|
|
146
|
+
(_props$onCloseComplet = props.onCloseComplete) === null || _props$onCloseComplet === void 0 ? void 0 : _props$onCloseComplet.call(props, ...args);
|
|
147
|
+
}
|
|
131
148
|
}
|
|
132
149
|
}))));
|
|
133
150
|
}));
|
package/dist/es2019/ui/main.js
CHANGED
|
@@ -26,7 +26,7 @@ const LinkCreateWithAnalyticsContext = withLinkCreateAnalyticsContext( /*#__PURE
|
|
|
26
26
|
}));
|
|
27
27
|
export const PACKAGE_DATA = {
|
|
28
28
|
packageName: "@atlaskit/link-create" || '',
|
|
29
|
-
packageVersion: "1.
|
|
29
|
+
packageVersion: "1.9.0" || '',
|
|
30
30
|
componentName: COMPONENT_NAME,
|
|
31
31
|
source: COMPONENT_NAME
|
|
32
32
|
};
|
|
@@ -6,7 +6,7 @@ var _excluded = ["testId", "triggeredFrom"],
|
|
|
6
6
|
_excluded2 = ["active", "modalTitle", "onCreate", "onFailure", "onCancel", "onOpenComplete", "onCloseComplete"];
|
|
7
7
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
8
8
|
/** @jsx jsx */
|
|
9
|
-
import { Fragment, useCallback, useState } from 'react';
|
|
9
|
+
import { Fragment, useCallback, useLayoutEffect, useRef, useState } from 'react';
|
|
10
10
|
import { jsx } from '@emotion/react';
|
|
11
11
|
import { useIntl } from 'react-intl-next';
|
|
12
12
|
import Modal, { ModalBody, ModalHeader, ModalTitle, ModalTransition } from '@atlaskit/modal-dialog';
|
|
@@ -123,6 +123,17 @@ var LinkCreateWithModal = function LinkCreateWithModal(_ref3) {
|
|
|
123
123
|
};
|
|
124
124
|
var LinkCreateModal = function LinkCreateModal(props) {
|
|
125
125
|
if (getBooleanFF('platform.linking-platform.link-create.enable-edit')) {
|
|
126
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
127
|
+
var shouldCallCloseComplete = useRef(!props.active);
|
|
128
|
+
|
|
129
|
+
// modal calls onCloseComplete in a useEffect(), so we can track whether
|
|
130
|
+
// or not we should execute it based on the active prop in a
|
|
131
|
+
// useLayoutEffect() which will be run before child useEffect()s
|
|
132
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
133
|
+
useLayoutEffect(function () {
|
|
134
|
+
// onCloseComplete should only be called when it is not active
|
|
135
|
+
shouldCallCloseComplete.current = !props.active;
|
|
136
|
+
}, [props.active]);
|
|
126
137
|
return jsx(LinkCreatePluginsProvider, {
|
|
127
138
|
plugins: props.plugins,
|
|
128
139
|
entityKey: props.entityKey
|
|
@@ -167,7 +178,16 @@ var LinkCreateModal = function LinkCreateModal(props) {
|
|
|
167
178
|
return function (_x2) {
|
|
168
179
|
return _ref6.apply(this, arguments);
|
|
169
180
|
};
|
|
170
|
-
}()
|
|
181
|
+
}(),
|
|
182
|
+
onCloseComplete: function onCloseComplete() {
|
|
183
|
+
if (shouldCallCloseComplete.current) {
|
|
184
|
+
var _props$onCloseComplet;
|
|
185
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
186
|
+
args[_key] = arguments[_key];
|
|
187
|
+
}
|
|
188
|
+
(_props$onCloseComplet = props.onCloseComplete) === null || _props$onCloseComplet === void 0 || _props$onCloseComplet.call.apply(_props$onCloseComplet, [props].concat(args));
|
|
189
|
+
}
|
|
190
|
+
}
|
|
171
191
|
}))));
|
|
172
192
|
});
|
|
173
193
|
});
|
package/dist/esm/ui/main.js
CHANGED
|
@@ -27,7 +27,7 @@ var LinkCreateWithAnalyticsContext = withLinkCreateAnalyticsContext( /*#__PURE__
|
|
|
27
27
|
}));
|
|
28
28
|
export var PACKAGE_DATA = {
|
|
29
29
|
packageName: "@atlaskit/link-create" || '',
|
|
30
|
-
packageVersion: "1.
|
|
30
|
+
packageVersion: "1.9.0" || '',
|
|
31
31
|
componentName: COMPONENT_NAME,
|
|
32
32
|
source: COMPONENT_NAME
|
|
33
33
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/link-create",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0",
|
|
4
4
|
"description": "The driver component of meta creation flow",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@atlaskit/form": "^9.0.0",
|
|
41
41
|
"@atlaskit/icon": "^21.12.0",
|
|
42
42
|
"@atlaskit/intl-messages-provider": "^1.0.0",
|
|
43
|
-
"@atlaskit/linking-common": "^4.
|
|
43
|
+
"@atlaskit/linking-common": "^4.18.0",
|
|
44
44
|
"@atlaskit/modal-dialog": "^12.8.0",
|
|
45
45
|
"@atlaskit/platform-feature-flags": "^0.2.1",
|
|
46
46
|
"@atlaskit/primitives": "^1.10.0",
|