-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
wp-core-data should not depend on wp-block-editor #64604
Comments
The same concern has been raised in the original PR - #51201 (comment). cc @ellatrix |
The behavior was reported again in #67334. cc @jsnajdr, @youknowriad |
Indeed, it seems like an arguable decision. If I'm reading the code properly, it seems the only reason we access it in "core-data" is because of the InnerBlocks.Content component? maybe some of this can be part of "blocks" package since this seems intrinsic to parsing/serializing blocks. cc @ellatrix |
Re-sharing the comment from @samueljseay left in #67334 for visibility:
|
I think using |
I checked the codebase, and the only place where gutenberg/packages/core-data/src/entity-provider.js Lines 199 to 200 in 3b89e82
There is some processing of the content that collects the metadata required to update post meta for the Footnotes block. Since #43204 More broadly, it would be great to understand why the general purpose React hook gutenberg/packages/core-data/src/entity-provider.js Lines 248 to 249 in 3b89e82
gutenberg/packages/core-data/src/entity-provider.js Lines 272 to 273 in 3b89e82
and the same usage of the callback:
I'm wondering if the solution would be extending the const onInput = useCallback(
( newBlocks, options ) => {
const { onEdit, selection } = options;
const edits = { blocks: newBlocks, selection };
registry.batch( () => {
onEdit?( newBlocks );
editEntityRecord( kind, name, id, edits );
} );
},
[ kind, name, id ]
); where function onEdit( blocks ) {
updateFootnotes( blocks );
}
|
Description
This is because wp-block-editor depends on lots of other scripts:- react, react-dom, react-jsx-runtime, wp-a11y, wp-api-fetch, wp-blob, wp-blocks, wp-commands, wp-components, wp-compose, wp-data, wp-date, wp-deprecated, wp-dom, wp-element, wp-hooks, wp-html-entities, wp-i18n, wp-is-shallow-equal, wp-keyboard-shortcuts, wp-keycodes, wp-notices, wp-preferences, wp-primitives, wp-private-apis, wp-rich-text, wp-style-engine, wp-token-list, wp-url, wp-warning, wp-wordcount
Leading to loading dozens of scripts just to use wp-core-data.
Step-by-step reproduction instructions
Add wp-core-data as a script dependancy
Screenshots, screen recording, code snippet
No response
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Please confirm that you have tested with all plugins deactivated except Gutenberg.
The text was updated successfully, but these errors were encountered: