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

[Widgets editor] Why do we need to have a post id and use useEntityBlockEditor? #25405

Closed
adamziel opened this issue Sep 17, 2020 · 1 comment
Labels
[Feature] Widgets Screen The block-based screen that replaced widgets.php. [Package] Edit Widgets /packages/edit-widgets

Comments

@adamziel
Copy link
Contributor

Originally reported in #24290 (comment)

@adamziel adamziel added [Feature] Widgets Screen The block-based screen that replaced widgets.php. [Package] Edit Widgets /packages/edit-widgets labels Sep 17, 2020
@adamziel
Copy link
Contributor Author

It seems like even if we get rid of the "temporary post" entity record, we need something in it's place. The editor is rendered in the following way:

const [ blocks, onInput, onChange ] = useEntityBlockEditor(
	KIND,
	POST_TYPE,
	{ id: 'temporary-post-id' }
);
<BlockEditorProvider
	value={ blocks }
	onInput={ onInput }
	onChange={ onChange }
>
    <BlockList />
</BlockEditorProvider>

Which means we need something to pass to <BlockEditorProvider />. Of course we could just store blocks in react state, but we need to be able to access them in different places and that's what the store is for. So maybe we could replace POST_TYPE with some other/new entity, but it's just a cosmetic change and the overall mechanics would stay the same. I'll move forward with this data model then @jorgefilipecosta @draganescu @noisysocks @kevin940726

I'm closing this one for now, let's discuss and reopen as needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Widgets Screen The block-based screen that replaced widgets.php. [Package] Edit Widgets /packages/edit-widgets
Projects
None yet
Development

No branches or pull requests

2 participants