Skip to content

Commit

Permalink
Merge pull request #10538 from marmelab/fix/doc_warnwhenusavedhcanges…
Browse files Browse the repository at this point in the history
…_on_dialogs

Fix dialogs doc for `warnWhenUnsavedChanges` sections
  • Loading branch information
djhi authored Feb 21, 2025
2 parents e8c299c + d0d2173 commit 1c3f9bb
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 12 deletions.
4 changes: 1 addition & 3 deletions docs/CreateDialog.md
Original file line number Diff line number Diff line change
Expand Up @@ -460,9 +460,7 @@ const EmployerEdit = () => (

## Warn When There Are Unsaved Changes

If you'd like to trigger a warning when the user tries to close the dialog with unsaved changes, there are two cases to consider.

In that case, you can leverage the [warnWhenUnsavedChanges](./Form.md#warnwhenunsavedchanges) feature provided by React Admin forms.
If you'd like to trigger a warning when the user tries to close the dialog with unsaved changes, you can leverage the [warnWhenUnsavedChanges](./Form.md#warnwhenunsavedchanges) feature provided by React Admin forms.

Add the `warnWhenUnsavedChanges` prop to your Form like so:

Expand Down
4 changes: 1 addition & 3 deletions docs/CreateInDialogButton.md
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,7 @@ You can also hide the title by passing `null`:

## Warn When There Are Unsaved Changes

If you'd like to trigger a warning when the user tries to close the dialog with unsaved changes, there are two cases to consider.

In that case, using the `warnWhenUnsavedChanges` prop directly on the form won't work, because this feature relies on the router's location, but both components do not use routing.
If you'd like to trigger a warning when the user tries to close the dialog with unsaved changes, using the `warnWhenUnsavedChanges` prop directly on the form won't work, because this feature relies on the router's location, but both components do not use routing.

Instead, you can use the `<WarnWhenUnsavedChangesInDialog>` component provided by `ra-form-layout`.

Expand Down
4 changes: 1 addition & 3 deletions docs/EditDialog.md
Original file line number Diff line number Diff line change
Expand Up @@ -502,9 +502,7 @@ const EmployerEdit = () => (

## Warn When There Are Unsaved Changes

If you'd like to trigger a warning when the user tries to close the dialog with unsaved changes, there are two cases to consider.

In that case, you can leverage the [warnWhenUnsavedChanges](./Form.md#warnwhenunsavedchanges) feature provided by React Admin forms.
If you'd like to trigger a warning when the user tries to close the dialog with unsaved changes, you can leverage the [warnWhenUnsavedChanges](./Form.md#warnwhenunsavedchanges) feature provided by React Admin forms.

Add the `warnWhenUnsavedChanges` prop to your Form like so:

Expand Down
4 changes: 1 addition & 3 deletions docs/EditInDialogButton.md
Original file line number Diff line number Diff line change
Expand Up @@ -384,9 +384,7 @@ const EmployerEdit = () => (

## Warn When There Are Unsaved Changes

If you'd like to trigger a warning when the user tries to close the dialog with unsaved changes, there are two cases to consider.

In that case, using the `warnWhenUnsavedChanges` prop directly on the form won't work, because this feature relies on the router's location, but both components do not use routing.
If you'd like to trigger a warning when the user tries to close the dialog with unsaved changes, using the `warnWhenUnsavedChanges` prop directly on the form won't work, because this feature relies on the router's location, but both components do not use routing.

Instead, you can use the `<WarnWhenUnsavedChangesInDialog>` component provided by `ra-form-layout`.

Expand Down

0 comments on commit 1c3f9bb

Please sign in to comment.