Skip to content

Commit

Permalink
fixed crash case with signals count
Browse files Browse the repository at this point in the history
- closes #233
  • Loading branch information
foxriver76 committed Dec 5, 2023
1 parent 31fd186 commit ecb351c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,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 if signals are used

### 2.9.4 (2023-12-04)
* (foxriver76) fixed issues with display width

Expand Down
4 changes: 2 additions & 2 deletions src/src/Attributes/Widget/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
} from '@mui/icons-material';

import { I18n, Utils } from '@iobroker/adapter-react-v5';
import { store, recalculateFields } from '../../Store';
import { store, recalculateFields, updateWidget } from '../../Store';

import WidgetField from './WidgetField';
import IODialog from '../../Components/IODialog';
Expand Down Expand Up @@ -681,7 +681,7 @@ class Widget extends Component {
}
signalsCount = i + 1;
if (signalsCount > 1) {
widgetData['signals-count'] = signalsCount;
store.dispatch(updateWidget({ widgetId: this.props.selectedWidgets[0], viewId: this.props.selectedView, data: { ...widget, data: { ...widget.data, 'signals-count': signalsCount } } }));
}
} else {
signalsCount = parseInt(widgetData['signals-count'], 10);
Expand Down
4 changes: 2 additions & 2 deletions src/src/Store.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { createReducer, configureStore, createAction } from '@reduxjs/toolkit';
import type { View, Widget, Project } from '@/types';

export const updateProject = createAction<Project>('project/update');
export const updateView = createAction<{viewId: string, data: View}>('view/update');
export const updateWidget = createAction<{viewId: string, widgetId: string, data: Widget}>('widget/update');
export const updateView = createAction<{viewId: string; data: View}>('view/update');
export const updateWidget = createAction<{viewId: string; widgetId: string; data: Widget}>('widget/update');
export const recalculateFields = createAction<boolean>('attributes/recalculate');

const reducer = createReducer(
Expand Down

0 comments on commit ecb351c

Please sign in to comment.