@atlaskit/editor-plugin-avatar-group 3.1.0 → 3.1.1

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,17 @@
1
1
  # @atlaskit/editor-plugin-avatar-group
2
2
 
3
+ ## 3.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#145269](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/145269)
8
+ [`737139c963111`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/737139c963111) -
9
+ [ux] Introduces an early-return guard inside `Avatars` that exits when `participants` is
10
+ null/undefined. Behind fg platform_editor_avatars_sort_error_fix. Prevents the runtime crash
11
+ `cannot read properties of undefined (reading sort)` observed while presence data is still
12
+ loading. For HOT-116939.
13
+ - Updated dependencies
14
+
3
15
  ## 3.1.0
4
16
 
5
17
  ### Minor Changes
@@ -10,6 +10,7 @@ var _react2 = require("@emotion/react");
10
10
  var _avatarGroup = _interopRequireDefault(require("@atlaskit/avatar-group"));
11
11
  var _analytics2 = require("@atlaskit/editor-common/analytics");
12
12
  var _state = require("@atlaskit/editor-prosemirror/state");
13
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
13
14
  var _styles = require("./styles");
14
15
  var _toAvatar = _interopRequireDefault(require("./to-avatar"));
15
16
  /**
@@ -45,6 +46,11 @@ var Avatars = exports.Avatars = /*#__PURE__*/_react.default.memo(function (props
45
46
  featureFlags = props.featureFlags,
46
47
  editorAPI = props.editorAPI;
47
48
  var participants = (_props$participants = props.participants) === null || _props$participants === void 0 ? void 0 : _props$participants.toArray();
49
+ if ((0, _platformFeatureFlags.fg)('platform_editor_avatars_sort_error_fix')) {
50
+ if (!participants) {
51
+ return null;
52
+ }
53
+ }
48
54
  var avatars = participants.sort(function (p) {
49
55
  return p.sessionId === sessionId ? -1 : 1;
50
56
  }).map(function (participant) {
@@ -10,6 +10,7 @@ import { jsx } from '@emotion/react';
10
10
  import AvatarGroup from '@atlaskit/avatar-group';
11
11
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
12
12
  import { Selection } from '@atlaskit/editor-prosemirror/state';
13
+ import { fg } from '@atlaskit/platform-feature-flags';
13
14
  import { avatarContainerStyles } from './styles';
14
15
  import toAvatar from './to-avatar';
15
16
  export const scrollToCollabCursor = (editorAPI, participants, sessionId, index, editorAnalyticsAPI) => {
@@ -41,6 +42,11 @@ export const Avatars = /*#__PURE__*/React.memo(props => {
41
42
  editorAPI
42
43
  } = props;
43
44
  const participants = (_props$participants = props.participants) === null || _props$participants === void 0 ? void 0 : _props$participants.toArray();
45
+ if (fg('platform_editor_avatars_sort_error_fix')) {
46
+ if (!participants) {
47
+ return null;
48
+ }
49
+ }
44
50
  const avatars = participants.sort(p => p.sessionId === sessionId ? -1 : 1).map(participant => toAvatar(participant, editorAPI));
45
51
  if (!avatars.length) {
46
52
  return null;
@@ -10,6 +10,7 @@ import { jsx } from '@emotion/react';
10
10
  import AvatarGroup from '@atlaskit/avatar-group';
11
11
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
12
12
  import { Selection } from '@atlaskit/editor-prosemirror/state';
13
+ import { fg } from '@atlaskit/platform-feature-flags';
13
14
  import { avatarContainerStyles } from './styles';
14
15
  import toAvatar from './to-avatar';
15
16
  export var scrollToCollabCursor = function scrollToCollabCursor(editorAPI, participants, sessionId, index, editorAnalyticsAPI) {
@@ -38,6 +39,11 @@ export var Avatars = /*#__PURE__*/React.memo(function (props) {
38
39
  featureFlags = props.featureFlags,
39
40
  editorAPI = props.editorAPI;
40
41
  var participants = (_props$participants = props.participants) === null || _props$participants === void 0 ? void 0 : _props$participants.toArray();
42
+ if (fg('platform_editor_avatars_sort_error_fix')) {
43
+ if (!participants) {
44
+ return null;
45
+ }
46
+ }
41
47
  var avatars = participants.sort(function (p) {
42
48
  return p.sessionId === sessionId ? -1 : 1;
43
49
  }).map(function (participant) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-avatar-group",
3
- "version": "3.1.0",
3
+ "version": "3.1.1",
4
4
  "description": "Avatar Group plugin for @atlaskit/editor-core.",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -37,16 +37,17 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@atlaskit/avatar-group": "^12.0.0",
40
- "@atlaskit/editor-common": "^103.4.0",
40
+ "@atlaskit/editor-common": "^103.15.0",
41
41
  "@atlaskit/editor-plugin-analytics": "^2.2.0",
42
42
  "@atlaskit/editor-plugin-collab-edit": "^3.4.0",
43
43
  "@atlaskit/editor-plugin-feature-flags": "^1.4.0",
44
44
  "@atlaskit/editor-plugin-primary-toolbar": "^3.2.0",
45
45
  "@atlaskit/editor-prosemirror": "7.0.0",
46
46
  "@atlaskit/editor-shared-styles": "^3.4.0",
47
- "@atlaskit/icon": "^25.5.0",
47
+ "@atlaskit/icon": "^25.6.0",
48
+ "@atlaskit/platform-feature-flags": "^1.1.0",
48
49
  "@atlaskit/theme": "^18.0.0",
49
- "@atlaskit/tokens": "^4.7.0",
50
+ "@atlaskit/tokens": "^4.8.0",
50
51
  "@babel/runtime": "^7.0.0",
51
52
  "@emotion/react": "^11.7.1",
52
53
  "memoize-one": "^6.0.0",
@@ -98,5 +99,10 @@
98
99
  "no-unused-dependencies": {
99
100
  "checkDevDependencies": true
100
101
  }
102
+ },
103
+ "platform-feature-flags": {
104
+ "platform_editor_avatars_sort_error_fix": {
105
+ "type": "boolean"
106
+ }
101
107
  }
102
108
  }