Skip to content

Commit

Permalink
fixed crash case for broken grouped widgets (#385)
Browse files Browse the repository at this point in the history
- closes #383
  • Loading branch information
foxriver76 authored Feb 27, 2024
1 parent 6215c89 commit 33cbf59
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,9 @@ E.g., if it was used in a menu and the menu is red, the circle would be red.
### **WORK IN PROGRESS**
-->
## Changelog
### **WORK IN PROGRESS**
* (foxriver76) fixed crash case for broken grouped widgets

### 2.9.34 (2024-02-26)
* (foxriver76) detect admin user correctly in project permissions dialog

Expand Down
9 changes: 7 additions & 2 deletions src/src/Vis/visUtils.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
import { I18n } from '@iobroker/adapter-react-v5';
import { deepClone } from '@/Utils/utils';
import { store, updateWidget } from '../Store';
import { store, updateView, updateWidget } from '../Store';

function replaceGroupAttr(inputStr, groupAttrList) {
let newString = inputStr;
Expand Down Expand Up @@ -382,7 +382,10 @@ function getUsedObjectIDsInWidget(views, view, wid, linkContext) {
groupNum++;
gId = `g${groupNum.toString().padStart(5, '0')}`;
}
views[view].widgets[gId] = {

const currView = deepClone(views[view]);

currView.widgets[gId] = {
tpl: '_tplGroup',
data: {
members: [wid],
Expand All @@ -395,6 +398,8 @@ function getUsedObjectIDsInWidget(views, view, wid, linkContext) {
},
widgetSet: null,
};

store.dispatch(updateView({ viewId: view, data: currView }));
}
}

Expand Down

0 comments on commit 33cbf59

Please sign in to comment.