@jetbrains/ring-ui 5.0.109 → 5.0.110

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.
@@ -46,6 +46,9 @@ const nonActivatableTypes = [
46
46
  function isActivatable(item) {
47
47
  return item != null && !nonActivatableTypes.includes(item.rgItemType) && !item.disabled;
48
48
  }
49
+ function getDataHash(data) {
50
+ return data.map(it => it.key).join('-');
51
+ }
49
52
  const shouldActivateFirstItem = (props) => props.activateFirstItem ||
50
53
  props.activateSingleItem && props.data.length === 1;
51
54
  export const ActiveItemContext = createStatefulContext(undefined, 'ActiveItem');
@@ -158,7 +161,7 @@ export default class List extends Component {
158
161
  this.virtualizedList.recomputeRowHeights();
159
162
  }
160
163
  if (this.props.activeIndex == null &&
161
- this.props.data !== prevProps.data &&
164
+ getDataHash(this.props.data) !== getDataHash(prevProps.data) &&
162
165
  shouldActivateFirstItem(this.props)) {
163
166
  this.activateFirst();
164
167
  }
package/dist/list/list.js CHANGED
@@ -63,6 +63,9 @@ const nonActivatableTypes = [Type.SEPARATOR, Type.TITLE, Type.MARGIN];
63
63
  function isActivatable(item) {
64
64
  return item != null && !nonActivatableTypes.includes(item.rgItemType) && !item.disabled;
65
65
  }
66
+ function getDataHash(data) {
67
+ return data.map(it => it.key).join('-');
68
+ }
66
69
  const shouldActivateFirstItem = props => props.activateFirstItem || props.activateSingleItem && props.data.length === 1;
67
70
  const ActiveItemContext = createStatefulContext(undefined, 'ActiveItem');
68
71
  /**
@@ -468,7 +471,7 @@ class List extends Component {
468
471
  if (this.virtualizedList && prevProps.data !== this.props.data) {
469
472
  this.virtualizedList.recomputeRowHeights();
470
473
  }
471
- if (this.props.activeIndex == null && this.props.data !== prevProps.data && shouldActivateFirstItem(this.props)) {
474
+ if (this.props.activeIndex == null && getDataHash(this.props.data) !== getDataHash(prevProps.data) && shouldActivateFirstItem(this.props)) {
472
475
  this.activateFirst();
473
476
  }
474
477
  this.checkOverflow();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetbrains/ring-ui",
3
- "version": "5.0.109",
3
+ "version": "5.0.110",
4
4
  "description": "JetBrains UI library",
5
5
  "author": "JetBrains",
6
6
  "license": "Apache-2.0",
@@ -158,14 +158,14 @@
158
158
  "react-test-renderer": "^18.2.0",
159
159
  "regenerator-runtime": "^0.13.11",
160
160
  "rimraf": "^4.1.2",
161
- "rollup": "^3.14.0",
161
+ "rollup": "^3.15.0",
162
162
  "rollup-plugin-clear": "^2.0.7",
163
163
  "rollup-plugin-styles": "^4.0.0",
164
164
  "sinon": "^15.0.1",
165
165
  "sinon-chai": "^3.7.0",
166
166
  "storage-mock": "^2.1.0",
167
167
  "storybook-addon-themes": "^6.1.0",
168
- "stylelint": "^14.16.1",
168
+ "stylelint": "^15.0.0",
169
169
  "svg-inline-loader": "^0.8.2",
170
170
  "teamcity-service-messages": "^0.1.14",
171
171
  "terser-webpack-plugin": "^5.3.6",