diff --git a/README.md b/README.md index 41c3182a..7d788a67 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/src/src/Vis/visUtils.jsx b/src/src/Vis/visUtils.jsx index 8f5f2afc..e9329416 100644 --- a/src/src/Vis/visUtils.jsx +++ b/src/src/Vis/visUtils.jsx @@ -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; @@ -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], @@ -395,6 +398,8 @@ function getUsedObjectIDsInWidget(views, view, wid, linkContext) { }, widgetSet: null, }; + + store.dispatch(updateView({ viewId: view, data: currView })); } }