Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed crash case with signals count #236

Merged
merged 1 commit into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading