mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-10 15:35:55 +01:00
🐛 Fix issues with updating tiles
This commit is contained in:
@@ -25,6 +25,7 @@ import { IWidget } from '../../../../widgets/widgets';
|
||||
import { DraggableList } from './DraggableList';
|
||||
|
||||
export type WidgetEditModalInnerProps = {
|
||||
widgetId: string;
|
||||
widgetType: string;
|
||||
options: IWidget<string, any>['properties'];
|
||||
widgetOptions: IWidget<string, any>['properties'];
|
||||
@@ -37,7 +38,6 @@ export const WidgetsEditModal = ({
|
||||
id,
|
||||
innerProps,
|
||||
}: ContextModalProps<WidgetEditModalInnerProps>) => {
|
||||
console.log('?');
|
||||
const { t } = useTranslation([`modules/${innerProps.widgetType}`, 'common']);
|
||||
const [moduleProperties, setModuleProperties] = useState(innerProps.options);
|
||||
const items = Object.entries(innerProps.widgetOptions ?? {}) as [
|
||||
@@ -64,15 +64,12 @@ export const WidgetsEditModal = ({
|
||||
updateConfig(
|
||||
configName,
|
||||
(prev) => {
|
||||
const currentWidget = prev.widgets.find((x) => x.type === innerProps.widgetType);
|
||||
const currentWidget = prev.widgets.find((x) => x.id === innerProps.widgetId);
|
||||
currentWidget!.properties = moduleProperties;
|
||||
|
||||
return {
|
||||
...prev,
|
||||
widgets: [
|
||||
...prev.widgets.filter((x) => x.type !== innerProps.widgetType),
|
||||
currentWidget!,
|
||||
],
|
||||
widgets: [...prev.widgets.filter((x) => x.id !== innerProps.widgetId), currentWidget!],
|
||||
};
|
||||
},
|
||||
true
|
||||
@@ -80,8 +77,6 @@ export const WidgetsEditModal = ({
|
||||
context.closeModal(id);
|
||||
};
|
||||
|
||||
console.log('??');
|
||||
|
||||
return (
|
||||
<Stack>
|
||||
{items.map(([key, _], index) => {
|
||||
|
||||
Reference in New Issue
Block a user