fix: improve dialog handling and error management in list items (#257)

* fix: improve dialog handling and error management in list items

* chore: lint
This commit is contained in:
Razboy20
2024-10-02 11:19:16 -05:00
committed by GitHub
parent a4d2856bfc
commit 1942508d8d
6 changed files with 38 additions and 24 deletions

View File

@@ -9,8 +9,8 @@ export type CloseWrapper<T> = (close: () => void) => T;
* Information about a dialog.
*/
export interface DialogInfo {
title?: JSX.Element;
description?: JSX.Element;
title?: string | JSX.Element;
description?: string | JSX.Element;
className?: string;
buttons?: JSX.Element | CloseWrapper<JSX.Element>;
onClose?: () => void;
@@ -24,7 +24,9 @@ export type ShowDialogFn = (info: DialogInfo | CloseWrapper<DialogInfo>) => void
/**
* Context for the dialog provider.
*/
export const DialogContext = createContext<ShowDialogFn>(() => {});
export const DialogContext = createContext<ShowDialogFn>(() => {
throw new Error('DialogContext not initialized.');
});
/**
* @returns The dialog context for showing dialogs.