@atlaskit/onboarding 14.0.1 → 14.0.2

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,14 @@
1
1
  # @atlaskit/onboarding
2
2
 
3
+ ## 14.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#139445](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/139445)
8
+ [`0f13df85731d6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0f13df85731d6) -
9
+ the component state update causes React Streming to have Suspense boundary received update before
10
+ hydrating finished error. Wrapping the state update in startTransition
11
+
3
12
  ## 14.0.1
4
13
 
5
14
  ### Patch Changes
@@ -61,7 +61,6 @@ var Clone = function Clone(props) {
61
61
  ,
62
62
  style: style
63
63
  }, /*#__PURE__*/_react.default.createElement("div", {
64
- // eslint-disable-next-line react/no-danger
65
64
  dangerouslySetInnerHTML: {
66
65
  __html: contentHTML
67
66
  }
@@ -104,20 +104,25 @@ var BenefitsModal = exports.default = /*#__PURE__*/function (_Component) {
104
104
  id: titleId
105
105
  }, heading);
106
106
  };
107
- return /*#__PURE__*/_react.default.createElement(_modalDialog.default, (0, _extends2.default)({
108
- autoFocus: true,
109
- shouldCloseOnEscapePress: false,
110
- shouldCloseOnOverlayClick: false,
111
- shouldScrollInViewport: true
112
- // @ts-ignore All of the following props were in the rest props, so I'm
113
- // making them explicit here even though the Modal doesn't accept them.
114
- ,
115
- experimental_shouldShowPrimaryButtonOnRight: experimental_shouldShowPrimaryButtonOnRight,
116
- footer: footer,
117
- header: header,
118
- heading: heading,
119
- image: image
120
- }, rest), /*#__PURE__*/_react.default.createElement(Header, null), /*#__PURE__*/_react.default.createElement(_modalDialog.ModalBody, null, /*#__PURE__*/_react.default.createElement(_modal.ModalBody, null, heading && /*#__PURE__*/_react.default.createElement(CustomHeader, null), children)), /*#__PURE__*/_react.default.createElement(Footer, null));
107
+ return (
108
+ /*#__PURE__*/
109
+ // TODO: This is a problem that needs solving: https://product-fabric.atlassian.net/browse/DSP-22238
110
+ // eslint-disable-next-line @atlaskit/design-system/use-modal-dialog-close-button
111
+ _react.default.createElement(_modalDialog.default, (0, _extends2.default)({
112
+ autoFocus: true,
113
+ shouldCloseOnEscapePress: false,
114
+ shouldCloseOnOverlayClick: false,
115
+ shouldScrollInViewport: true
116
+ // @ts-ignore All of the following props were in the rest props, so I'm
117
+ // making them explicit here even though the Modal doesn't accept them.
118
+ ,
119
+ experimental_shouldShowPrimaryButtonOnRight: experimental_shouldShowPrimaryButtonOnRight,
120
+ footer: footer,
121
+ header: header,
122
+ heading: heading,
123
+ image: image
124
+ }, rest), /*#__PURE__*/_react.default.createElement(Header, null), /*#__PURE__*/_react.default.createElement(_modalDialog.ModalBody, null, /*#__PURE__*/_react.default.createElement(_modal.ModalBody, null, heading && /*#__PURE__*/_react.default.createElement(CustomHeader, null), children)), /*#__PURE__*/_react.default.createElement(Footer, null))
125
+ );
121
126
  }
122
127
  }]);
123
128
  }(_react.Component);
@@ -15,6 +15,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
15
15
  var _react = _interopRequireWildcard(require("react"));
16
16
  var _memoizeOne = _interopRequireDefault(require("memoize-one"));
17
17
  var _noop = _interopRequireDefault(require("@atlaskit/ds-lib/noop"));
18
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
18
19
  var _portal = _interopRequireDefault(require("@atlaskit/portal"));
19
20
  var _blanket = _interopRequireDefault(require("../styled/blanket"));
20
21
  var _animation = require("./animation");
@@ -62,7 +63,23 @@ var SpotlightManager = exports.default = /*#__PURE__*/function (_PureComponent)
62
63
  spotlightCount: 0,
63
64
  targets: {}
64
65
  });
65
- (0, _defineProperty2.default)(_this, "getTargetRef", function (name) {
66
+ /*
67
+ * When enabling React Streaming in Confluence, a
68
+ * "This Suspense boundary received an update before it finished hydrating. This caused the boundary to switch to client rendering"
69
+ * error happens.
70
+ * This is to fix this error by wrapping the state update in startTransition as suggested by React: https://react.dev/errors/421?invariant=421
71
+ */
72
+ (0, _defineProperty2.default)(_this, "getTargetRef", (0, _platformFeatureFlags.fg)('platform_fix_component_state_update_for_suspense') ? function (name) {
73
+ return function (element) {
74
+ (0, _react.startTransition)(function () {
75
+ _this.setState(function (state) {
76
+ return {
77
+ targets: _objectSpread(_objectSpread({}, state.targets), {}, (0, _defineProperty2.default)({}, name, element || undefined))
78
+ };
79
+ });
80
+ });
81
+ };
82
+ } : function (name) {
66
83
  return function (element) {
67
84
  _this.setState(function (state) {
68
85
  return {
@@ -13,8 +13,6 @@ var _compiled = require("@atlaskit/primitives/compiled");
13
13
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
14
14
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
15
15
  var modalBodyStyles = null;
16
-
17
- // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-array-arguments -- Ignored via go/DSP-18766
18
16
  var modalHeadingStyles = null;
19
17
  var modalImageStyles = null;
20
18
  var modalActionContainerStyles = null;
@@ -94,7 +94,6 @@ var TargetOverlay = exports.TargetOverlay = function TargetOverlay(_ref3) {
94
94
  onClick: onClick
95
95
  // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
96
96
  }, props, {
97
- // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
98
97
  style: {
99
98
  cursor: onClick ? 'pointer' : 'auto'
100
99
  },
@@ -84,10 +84,7 @@ function callWhenIdle(callback) {
84
84
  var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
85
85
  var _opts$timeout = opts.timeout,
86
86
  timeout = _opts$timeout === void 0 ? 100 : _opts$timeout;
87
-
88
- // eslint-disable-next-line compat/compat
89
87
  if (typeof window.requestIdleCallback === 'function') {
90
- // eslint-disable-next-line compat/compat
91
88
  var idleHandle = window.requestIdleCallback(callback, {
92
89
  timeout: timeout
93
90
  });
@@ -52,7 +52,6 @@ const Clone = props => {
52
52
  ,
53
53
  style: style
54
54
  }, /*#__PURE__*/React.createElement("div", {
55
- // eslint-disable-next-line react/no-danger
56
55
  dangerouslySetInnerHTML: {
57
56
  __html: contentHTML
58
57
  }
@@ -81,19 +81,24 @@ export default class BenefitsModal extends Component {
81
81
  id: titleId
82
82
  }, heading);
83
83
  };
84
- return /*#__PURE__*/React.createElement(Modal, _extends({
85
- autoFocus: true,
86
- shouldCloseOnEscapePress: false,
87
- shouldCloseOnOverlayClick: false,
88
- shouldScrollInViewport: true
89
- // @ts-ignore All of the following props were in the rest props, so I'm
90
- // making them explicit here even though the Modal doesn't accept them.
91
- ,
92
- experimental_shouldShowPrimaryButtonOnRight: experimental_shouldShowPrimaryButtonOnRight,
93
- footer: footer,
94
- header: header,
95
- heading: heading,
96
- image: image
97
- }, rest), /*#__PURE__*/React.createElement(Header, null), /*#__PURE__*/React.createElement(ModalBody, null, /*#__PURE__*/React.createElement(Body, null, heading && /*#__PURE__*/React.createElement(CustomHeader, null), children)), /*#__PURE__*/React.createElement(Footer, null));
84
+ return (
85
+ /*#__PURE__*/
86
+ // TODO: This is a problem that needs solving: https://product-fabric.atlassian.net/browse/DSP-22238
87
+ // eslint-disable-next-line @atlaskit/design-system/use-modal-dialog-close-button
88
+ React.createElement(Modal, _extends({
89
+ autoFocus: true,
90
+ shouldCloseOnEscapePress: false,
91
+ shouldCloseOnOverlayClick: false,
92
+ shouldScrollInViewport: true
93
+ // @ts-ignore All of the following props were in the rest props, so I'm
94
+ // making them explicit here even though the Modal doesn't accept them.
95
+ ,
96
+ experimental_shouldShowPrimaryButtonOnRight: experimental_shouldShowPrimaryButtonOnRight,
97
+ footer: footer,
98
+ header: header,
99
+ heading: heading,
100
+ image: image
101
+ }, rest), /*#__PURE__*/React.createElement(Header, null), /*#__PURE__*/React.createElement(ModalBody, null, /*#__PURE__*/React.createElement(Body, null, heading && /*#__PURE__*/React.createElement(CustomHeader, null), children)), /*#__PURE__*/React.createElement(Footer, null))
102
+ );
98
103
  }
99
104
  }
@@ -1,7 +1,8 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import React, { createContext, PureComponent } from 'react';
2
+ import React, { createContext, PureComponent, startTransition } from 'react';
3
3
  import memoizeOne from 'memoize-one';
4
4
  import noop from '@atlaskit/ds-lib/noop';
5
+ import { fg } from '@atlaskit/platform-feature-flags';
5
6
  import Portal from '@atlaskit/portal';
6
7
  import Blanket from '../styled/blanket';
7
8
  import { Fade } from './animation';
@@ -42,7 +43,22 @@ export default class SpotlightManager extends PureComponent {
42
43
  spotlightCount: 0,
43
44
  targets: {}
44
45
  });
45
- _defineProperty(this, "getTargetRef", name => element => {
46
+ /*
47
+ * When enabling React Streaming in Confluence, a
48
+ * "This Suspense boundary received an update before it finished hydrating. This caused the boundary to switch to client rendering"
49
+ * error happens.
50
+ * This is to fix this error by wrapping the state update in startTransition as suggested by React: https://react.dev/errors/421?invariant=421
51
+ */
52
+ _defineProperty(this, "getTargetRef", fg('platform_fix_component_state_update_for_suspense') ? name => element => {
53
+ startTransition(() => {
54
+ this.setState(state => ({
55
+ targets: {
56
+ ...state.targets,
57
+ [name]: element || undefined
58
+ }
59
+ }));
60
+ });
61
+ } : name => element => {
46
62
  this.setState(state => ({
47
63
  targets: {
48
64
  ...state.targets,
@@ -4,8 +4,6 @@ import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
5
5
  import { Box } from '@atlaskit/primitives/compiled';
6
6
  const modalBodyStyles = null;
7
-
8
- // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-array-arguments -- Ignored via go/DSP-18766
9
7
  const modalHeadingStyles = null;
10
8
  const modalImageStyles = null;
11
9
  const modalActionContainerStyles = null;
@@ -77,7 +77,6 @@ export const TargetOverlay = ({
77
77
  onClick: onClick
78
78
  // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
79
79
  }, props, {
80
- // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
81
80
  style: {
82
81
  cursor: onClick ? 'pointer' : 'auto'
83
82
  },
@@ -71,10 +71,7 @@ function callWhenIdle(callback, opts = {}) {
71
71
  const {
72
72
  timeout = 100
73
73
  } = opts;
74
-
75
- // eslint-disable-next-line compat/compat
76
74
  if (typeof window.requestIdleCallback === 'function') {
77
- // eslint-disable-next-line compat/compat
78
75
  const idleHandle = window.requestIdleCallback(callback, {
79
76
  timeout
80
77
  });
@@ -52,7 +52,6 @@ var Clone = function Clone(props) {
52
52
  ,
53
53
  style: style
54
54
  }, /*#__PURE__*/React.createElement("div", {
55
- // eslint-disable-next-line react/no-danger
56
55
  dangerouslySetInnerHTML: {
57
56
  __html: contentHTML
58
57
  }
@@ -95,20 +95,25 @@ var BenefitsModal = /*#__PURE__*/function (_Component) {
95
95
  id: titleId
96
96
  }, heading);
97
97
  };
98
- return /*#__PURE__*/React.createElement(Modal, _extends({
99
- autoFocus: true,
100
- shouldCloseOnEscapePress: false,
101
- shouldCloseOnOverlayClick: false,
102
- shouldScrollInViewport: true
103
- // @ts-ignore All of the following props were in the rest props, so I'm
104
- // making them explicit here even though the Modal doesn't accept them.
105
- ,
106
- experimental_shouldShowPrimaryButtonOnRight: experimental_shouldShowPrimaryButtonOnRight,
107
- footer: footer,
108
- header: header,
109
- heading: heading,
110
- image: image
111
- }, rest), /*#__PURE__*/React.createElement(Header, null), /*#__PURE__*/React.createElement(ModalBody, null, /*#__PURE__*/React.createElement(Body, null, heading && /*#__PURE__*/React.createElement(CustomHeader, null), children)), /*#__PURE__*/React.createElement(Footer, null));
98
+ return (
99
+ /*#__PURE__*/
100
+ // TODO: This is a problem that needs solving: https://product-fabric.atlassian.net/browse/DSP-22238
101
+ // eslint-disable-next-line @atlaskit/design-system/use-modal-dialog-close-button
102
+ React.createElement(Modal, _extends({
103
+ autoFocus: true,
104
+ shouldCloseOnEscapePress: false,
105
+ shouldCloseOnOverlayClick: false,
106
+ shouldScrollInViewport: true
107
+ // @ts-ignore All of the following props were in the rest props, so I'm
108
+ // making them explicit here even though the Modal doesn't accept them.
109
+ ,
110
+ experimental_shouldShowPrimaryButtonOnRight: experimental_shouldShowPrimaryButtonOnRight,
111
+ footer: footer,
112
+ header: header,
113
+ heading: heading,
114
+ image: image
115
+ }, rest), /*#__PURE__*/React.createElement(Header, null), /*#__PURE__*/React.createElement(ModalBody, null, /*#__PURE__*/React.createElement(Body, null, heading && /*#__PURE__*/React.createElement(CustomHeader, null), children)), /*#__PURE__*/React.createElement(Footer, null))
116
+ );
112
117
  }
113
118
  }]);
114
119
  }(Component);
@@ -8,9 +8,10 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
8
8
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
9
9
  function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
10
10
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
11
- import React, { createContext, PureComponent } from 'react';
11
+ import React, { createContext, PureComponent, startTransition } from 'react';
12
12
  import memoizeOne from 'memoize-one';
13
13
  import noop from '@atlaskit/ds-lib/noop';
14
+ import { fg } from '@atlaskit/platform-feature-flags';
14
15
  import Portal from '@atlaskit/portal';
15
16
  import Blanket from '../styled/blanket';
16
17
  import { Fade } from './animation';
@@ -54,7 +55,23 @@ var SpotlightManager = /*#__PURE__*/function (_PureComponent) {
54
55
  spotlightCount: 0,
55
56
  targets: {}
56
57
  });
57
- _defineProperty(_this, "getTargetRef", function (name) {
58
+ /*
59
+ * When enabling React Streaming in Confluence, a
60
+ * "This Suspense boundary received an update before it finished hydrating. This caused the boundary to switch to client rendering"
61
+ * error happens.
62
+ * This is to fix this error by wrapping the state update in startTransition as suggested by React: https://react.dev/errors/421?invariant=421
63
+ */
64
+ _defineProperty(_this, "getTargetRef", fg('platform_fix_component_state_update_for_suspense') ? function (name) {
65
+ return function (element) {
66
+ startTransition(function () {
67
+ _this.setState(function (state) {
68
+ return {
69
+ targets: _objectSpread(_objectSpread({}, state.targets), {}, _defineProperty({}, name, element || undefined))
70
+ };
71
+ });
72
+ });
73
+ };
74
+ } : function (name) {
58
75
  return function (element) {
59
76
  _this.setState(function (state) {
60
77
  return {
@@ -4,8 +4,6 @@ import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
5
5
  import { Box } from '@atlaskit/primitives/compiled';
6
6
  var modalBodyStyles = null;
7
-
8
- // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-array-arguments -- Ignored via go/DSP-18766
9
7
  var modalHeadingStyles = null;
10
8
  var modalImageStyles = null;
11
9
  var modalActionContainerStyles = null;
@@ -84,7 +84,6 @@ export var TargetOverlay = function TargetOverlay(_ref3) {
84
84
  onClick: onClick
85
85
  // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
86
86
  }, props, {
87
- // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
88
87
  style: {
89
88
  cursor: onClick ? 'pointer' : 'auto'
90
89
  },
@@ -77,10 +77,7 @@ function callWhenIdle(callback) {
77
77
  var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
78
78
  var _opts$timeout = opts.timeout,
79
79
  timeout = _opts$timeout === void 0 ? 100 : _opts$timeout;
80
-
81
- // eslint-disable-next-line compat/compat
82
80
  if (typeof window.requestIdleCallback === 'function') {
83
- // eslint-disable-next-line compat/compat
84
81
  var idleHandle = window.requestIdleCallback(callback, {
85
82
  timeout: timeout
86
83
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/onboarding",
3
- "version": "14.0.1",
3
+ "version": "14.0.2",
4
4
  "description": "An onboarding spotlight introduces new features to users through focused messages or multi-step tours.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -41,15 +41,15 @@
41
41
  "@atlaskit/button": "^23.0.0",
42
42
  "@atlaskit/css": "^0.10.0",
43
43
  "@atlaskit/ds-lib": "^4.0.0",
44
- "@atlaskit/heading": "^5.1.0",
44
+ "@atlaskit/heading": "^5.2.0",
45
45
  "@atlaskit/layering": "^2.1.0",
46
46
  "@atlaskit/modal-dialog": "^14.1.0",
47
47
  "@atlaskit/motion": "^5.1.0",
48
48
  "@atlaskit/platform-feature-flags": "^1.1.0",
49
49
  "@atlaskit/popper": "^7.0.0",
50
50
  "@atlaskit/portal": "^5.1.0",
51
- "@atlaskit/primitives": "^14.2.0",
52
- "@atlaskit/tokens": "^4.5.0",
51
+ "@atlaskit/primitives": "^14.4.0",
52
+ "@atlaskit/tokens": "^4.8.0",
53
53
  "@babel/runtime": "^7.0.0",
54
54
  "@compiled/react": "^0.18.3",
55
55
  "bind-event-listener": "^3.0.0",
@@ -101,6 +101,9 @@
101
101
  "platform_design_system_team_transition_group_r18": {
102
102
  "type": "boolean",
103
103
  "referenceOnly": true
104
+ },
105
+ "platform_fix_component_state_update_for_suspense": {
106
+ "type": "boolean"
104
107
  }
105
108
  },
106
109
  "techstack": {