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

Block API: Add action to update existing block registration #20548

Open
aduth opened this issue Feb 28, 2020 · 0 comments
Open

Block API: Add action to update existing block registration #20548

aduth opened this issue Feb 28, 2020 · 0 comments
Labels
[Feature] Block API API that allows to express the block paradigm. [Type] Task Issues or PRs that have been broken down into an individual action to take

Comments

@aduth
Copy link
Member

aduth commented Feb 28, 2020

Previously: #20544 (comment)

The implementation of #20544 highlights a use-case where it may be necessary to update registered block settings after the initial registration. Today, this can only be achieved by a (non-ideal) mutation of the result of getBlockType.

There is already some precedent in how server-side and client-side registrations are reconciled, where server-side block registrations behave as something of a "base" that the client-side registration updates (source).

Task: Implement means to update existing block registration.

Implementation Ideas:

This may or may not need new APIs. It could be possible to change the behavior of registerBlockType such that "registering" an existing type would simply merge with the current settings.

If a new API is needed, it could be expressed as something like extendBlockType.

Consider also:

  • Could this help replace the need for unstable__bootstrapServerSideBlockDefinitions ?
  • Will this be a "footgun" if those settings updates aren't reflected based on timings (e.g. attribute types validation only accounted for at initial parse)?
  • Should "re-registration" really merge to an existing block type? What about a use-case where I want to wholly replace a block type settings? If we do merge, should it be a shallow merge or a deep merge (e.g. should setting new attributes replace or merge to existing attributes)?
@aduth aduth added [Type] Task Issues or PRs that have been broken down into an individual action to take [Feature] Block API API that allows to express the block paradigm. labels Feb 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Block API API that allows to express the block paradigm. [Type] Task Issues or PRs that have been broken down into an individual action to take
Projects
None yet
Development

No branches or pull requests

1 participant