Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@
const onLayoutEditorCreateWidgetInstance = useCallback(() => {
const newId = generateDashboardId();
const widgetTypes = getWidgets();
if (widgetTypes.length === 0) {
throw new Error('No registered widget types found. Code: 9ca3dd78');
}
const widgetType = widgetTypes[0];

const configuration = widgetType.createConfig({});
Expand Down Expand Up @@ -262,6 +265,7 @@
const { dashboardId, dashboard, widgetInstances } =
loaderSchema.parse(loaderData);

// eslint-disable-next-line react-hooks/set-state-in-effect

Check failure on line 268 in frontend-react/src/lib/application/routes/dashboard-editor/dashboard-editor.tsx

View workflow job for this annotation

GitHub Actions / Lint

Definition for rule 'react-hooks/set-state-in-effect' was not found

Check failure on line 268 in frontend-react/src/lib/application/routes/dashboard-editor/dashboard-editor.tsx

View workflow job for this annotation

GitHub Actions / Lint

Definition for rule 'react-hooks/set-state-in-effect' was not found
setLocalDashboard({
selection: {
x: 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,16 @@ export function LayoutEditor(props: LayoutEditorProps) {
return state;
}

const widgetId = props.onCreateWidgetInstance();
return select(fillWith(state, widgetId, bounds), bounds);
try {
const widgetId = props.onCreateWidgetInstance();
return select(fillWith(state, widgetId, bounds), bounds);
} catch (err) {
console.error('Could not create widget instance.', {
code: 'e732b33a',
cause: err
});
return state;
}
});
},
[applyLayoutChange, props]
Expand Down
Loading