@iobroker/adapter-react-v5 8.2.13 → 8.3.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.
@@ -605,7 +605,7 @@ export function applyFilter(item, filters, lang, objects, context, counter, cust
605
605
  filteredOut = !context.nameRx.test(data.fName);
606
606
  }
607
607
  }
608
- if (!filteredOut && filters.role?.length && common) {
608
+ if (!filteredOut && filters.role?.length && common && context.role?.length) {
609
609
  filteredOut = !(typeof common.role === 'string' && context.role.find(role => common.role.startsWith(role)));
610
610
  }
611
611
  if (!filteredOut && context.room?.length) {
@@ -866,6 +866,9 @@ export function buildTree(objects, options) {
866
866
  }
867
867
  else if (cRoot.children) {
868
868
  cRoot = cRoot.children.find(item => item.data.name === parts[k]);
869
+ if (!cRoot) {
870
+ throw new Error('Cannot find root in children!');
871
+ }
869
872
  }
870
873
  }
871
874
  }
@@ -933,8 +936,8 @@ export function buildTree(objects, options) {
933
936
  } while (repeat);
934
937
  }
935
938
  info.roomEnums.sort((a, b) => {
936
- const aName = getName(objects[a]?.common?.name, options.lang) || a.split('.').pop();
937
- const bName = getName(objects[b]?.common?.name, options.lang) || b.split('.').pop();
939
+ const aName = getName(objects[a]?.common?.name, options.lang) || a.split('.').pop() || '';
940
+ const bName = getName(objects[b]?.common?.name, options.lang) || b.split('.').pop() || '';
938
941
  if (aName > bName) {
939
942
  return 1;
940
943
  }
@@ -944,8 +947,8 @@ export function buildTree(objects, options) {
944
947
  return 0;
945
948
  });
946
949
  info.funcEnums.sort((a, b) => {
947
- const aName = getName(objects[a]?.common?.name, options.lang) || a.split('.').pop();
948
- const bName = getName(objects[b]?.common?.name, options.lang) || b.split('.').pop();
950
+ const aName = getName(objects[a]?.common?.name, options.lang) || a.split('.').pop() || '';
951
+ const bName = getName(objects[b]?.common?.name, options.lang) || b.split('.').pop() || '';
949
952
  if (aName > bName) {
950
953
  return 1;
951
954
  }
@@ -978,7 +981,7 @@ export function findNode(root, id, _parts, _path, _level) {
978
981
  found = root.children[i];
979
982
  break;
980
983
  }
981
- else if (_id > _path) {
984
+ else if (_id > (_path || '')) {
982
985
  break;
983
986
  }
984
987
  }