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

Use entities on the widget screen #17319

wants to merge 1 commit into
base: master


Copy link

commented Sep 3, 2019


The PR uses the entities mechanism in the widget screen and makes the update button only allow updates when there are unsaved changes.
The edit-widgets store is deleted, we don't need it anymore we can rely purely on the entities.
It still needs some additional tests to make sure it causes no regressions.
Fixes: #16605


I verified the update buttons on the widget screen only is enabled after some changes are done.
I did some smoke tests and did not found any regression, I noticed an existing bug on the customizer blocks during the first block change an error is logged into the console.

@jorgefilipecosta jorgefilipecosta changed the title WIP: use entities on the widget screen. Use entities on the widget screen Sep 4, 2019

@jorgefilipecosta jorgefilipecosta requested a review from epiqueras Sep 4, 2019


This comment has been minimized.

Copy link

commented Sep 4, 2019

It's awesome that we could remove so much code here.

Would this benefit even further from the new APIs that are about to be introduced?:

Declarative and composable entity provider with dynamic entity type-kind-specific context creation:

<EntityProvider kind="site" type="root">
  <EntityProvider kind="postType" type={ post.type } id={ }>
    { children }
    <InnerBlocks />

A few nice hooks for leveraging entities:

const id = useEntityId( 'postType', 'post' );
const [ content, setContent ] = useEntityProp( 'postType', 'post', 'content' );
const [ isDirty, isSaving, save ] = useEntitySaving(

And controlled inner blocks:

  value={ blocks }
  onChange={ setBlocks }
  onInput={ setContent }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.