@iobroker/gui-components 10.3.11 → 10.3.13

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.
@@ -818,6 +818,10 @@ export function buildTree(objects, options) {
818
818
  aliasesMap: {},
819
819
  };
820
820
  let cRoot = root;
821
+ // `info.ids` is not sorted for a binary search: a generated level follows the ID that created it, and the
822
+ // sorting above ('.' as '!!!') is not the plain string order. A missed level was created a second time:
823
+ // two nodes with the same ID (https://github.com/ioBroker/ioBroker.admin/issues/3693)
824
+ const knownIds = new Set();
821
825
  for (let i = 0; i < ids.length; i++) {
822
826
  const id = ids[i];
823
827
  if (!id) {
@@ -888,6 +892,7 @@ export function buildTree(objects, options) {
888
892
  }
889
893
  }
890
894
  info.ids.push(id);
895
+ knownIds.add(id);
891
896
  let repeat;
892
897
  // if next level
893
898
  do {
@@ -901,7 +906,7 @@ export function buildTree(objects, options) {
901
906
  for (let k = currentPathLen; k < parts.length - 1; k++) {
902
907
  curPath += (curPath ? '.' : '') + parts[k];
903
908
  // level does not exist
904
- if (!binarySearch(info.ids, curPath)) {
909
+ if (!knownIds.has(curPath)) {
905
910
  const _cRoot = {
906
911
  data: {
907
912
  name: parts[k],
@@ -916,7 +921,8 @@ export function buildTree(objects, options) {
916
921
  cRoot.children ||= [];
917
922
  cRoot.children.push(_cRoot);
918
923
  cRoot = _cRoot;
919
- info.ids.push(curPath); // IDs will be added by alphabet
924
+ info.ids.push(curPath);
925
+ knownIds.add(curPath);
920
926
  }
921
927
  else if (cRoot.children) {
922
928
  cRoot = cRoot.children.find(item => item.data.name === parts[k]);