-
-
Notifications
You must be signed in to change notification settings - Fork 730
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Call applyBlockDefaults from addBlock/insertBlock, add initialValue()…
… configuration option for blocks (#5320) Co-authored-by: Steve Piercy <web@stevepiercy.com>
- Loading branch information
1 parent
6520d8e
commit 37baeef
Showing
4 changed files
with
238 additions
and
57 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
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,5 @@ | ||
For blocks that define their `blockSchema`, call `applyBlockDefaults` when creating the initial data for the blocks form. | ||
It is now possible to define a block configuration function, `initialValue` that returns the initial value for a block. This is useful in use cases such as container blocks that want to create a complex initial data structure, to avoid the need to call `React.useEffect` on their initial block rendering and thus, avoid complex async "concurent" state mutations. | ||
The `addBlock`, `mutateBlock`, `insertBlock` now allow passing a `blocksConfig` configuration object | ||
|
||
@tiberiuichim |
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
Oops, something went wrong.