-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FinalForm: remove default
onAfterSubmit
implementation (#1446)
(2 breaking changes I wanted to do for a long time) The default implementation of onAfterSubmit did two things: - stackApi?.goBack(); - editDialog?.closeDialog({ delay: true }); Those where removed because there are now better ways to do this, and in many (most) cases the default implementation was disabled. - Stack go back: - The SaveSplitButton does go back conditionally, so it has to do it on it's own - we don't want a split button in future anyway - EditDialog close: - currently not solved, a future PR will fix this. Could also be fixed using #1441 once that is merged It is generally a bad idea to - have dependencies from one component (FinalForm) to random other ones (Stack, EditDialog) - instead this communication should be done using well thought apis ---- Additionally I also remove the Loading animation shown while submitting. Nowadays we have the SaveButton that has it's own animation during submitting --------- Co-authored-by: Johannes Obermair <48853629+johnnyomair@users.noreply.github.com>
- Loading branch information
1 parent
d20f59c
commit 298b63b
Showing
11 changed files
with
31 additions
and
184 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
"@comet/admin": major | ||
--- | ||
|
||
FinalForm: remove default `onAfterSubmit` implementation | ||
|
||
In most cases the default implementation is not needed anymore. When upgrading, an empty | ||
function override of `onAfterSubmit` can be removed as it is not necessary any longer. | ||
|
||
To get back the old behavior use the following in application code: | ||
|
||
``` | ||
const stackApi = React.useContext(StackApiContext); | ||
const editDialog = React.useContext(EditDialogApiContext); | ||
.... | ||
<FinalForm | ||
onAfterSubmit={() => { | ||
stackApi?.goBack(); | ||
editDialog?.closeDialog({ delay: true }); | ||
}} | ||
> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 0 additions & 88 deletions
88
packages/admin/admin-stories/src/docs/form/stories/ContextBasedFeatures.stories.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters