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

Best practice stories: Use EditDialog instead of MUIs Dialog #2901

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

andrearutrecht
Copy link
Contributor

@andrearutrecht andrearutrecht commented Dec 9, 2024

Description

All MUI dialogs in the best practice stories are replaced with EditDialog. This adds the dirty handler dialog to prevent losing unsaved changes.

Screenshots/screencasts

Saving behaviour:

Screen.Recording.2024-12-09.at.13.34.10.mp4

Error behaviour:

Screen.Recording.2024-12-09.at.13.35.39.mp4

Changeset

  • I have verified if my change requires a changeset

@andrearutrecht andrearutrecht self-assigned this Dec 9, 2024
@andrearutrecht andrearutrecht marked this pull request as ready for review December 9, 2024 12:37
@auto-assign auto-assign bot requested a review from johnnyomair December 9, 2024 12:37
Comment on lines +454 to +456
<EditDialog title={mode === "add" ? "Add new item" : `${rows.find((row) => row.id === selectedId)?.title}`}>
<Form id={mode === "add" ? undefined : selectedId} />
</EditDialog>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thomasdax98 is this how the EditDialog should be used with Selection? Seems odd to me...

@@ -975,7 +932,7 @@ export const GridWithSelectionInDialog = {
<ToolbarAutomaticTitleItem />
<ToolbarFillSpace />
<ToolbarActions>
<Button color="primary" variant="contained" startIcon={<SelectIcon />} onClick={() => setShowDialog(true)}>
<Button color="primary" variant="contained" startIcon={<SelectIcon />} onClick={() => editDialogApi.openAddDialog()}>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be openEditDialog, since you're editing the current selection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants