Skip to content

Core Data: Move EntitiesSavedState component out of editor (rebase of #71948) - #80485

Merged
youknowriad merged 3 commits into
WordPress:trunkfrom
enejb:rebase/entities-saved-state-core-data
Jul 23, 2026
Merged

Core Data: Move EntitiesSavedState component out of editor (rebase of #71948)#80485
youknowriad merged 3 commits into
WordPress:trunkfrom
enejb:rebase/entities-saved-state-core-data

Conversation

@enejb

@enejb enejb commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

What / Why

This is a rebase of #71948 ("Core Data: Move EntitiesSavedState component out of editor" by @youknowriad) onto current trunk. The original PR was ~4,400 commits behind and conflicting; this branch reapplies it on top of the latest trunk.

Rebase of #71948

What the PR does

Moves the EntitiesSavedStates component, its hooks/utils, and the saveDirtyEntities action from @wordpress/editor into @wordpress/core-data:

  • entities-saved-states/* component → core-data/src/components/entities-saved-states/
  • get-template-info.js, get-template-part-icon.js utils → core-data/src/utils/
  • saveDirtyEntities action → core-data/src/private-actions.js
  • Exposed via core-data private APIs (EntitiesSavedStates, EntitiesSavedStatesExtensible, getTemplateInfo, getTemplatePartIcon, useEntitiesSavedStatesIsDirty)
  • editor re-exports EntitiesSavedStates / useEntitiesSavedStatesIsDirty for back-compat; consumers updated to read getTemplateInfo/getTemplatePartIcon from core-data.

Notable rebase decisions (please verify)

  1. saveDirtyEntities kept trunk's newer logic. The moved action uses trunk's current implementation (await onSave() from Editor: saveDirtyEntities: don't allow onSave to filter records #79850, successNoticeContent param) rather than the older version in the original PR.
  2. __unstableMarkLastChangeAsPersistent() kept functional. Original PR commit 2 ("Remove useless code") deleted this blockEditorStore call. I instead kept it active in the core-data version to preserve trunk's exact save behavior (core-data already depends on block-editor here). Commit 2 was therefore skipped. This is the main thing to confirm.
  3. New trunk consumers fixed: post-excerpt/panel.js and sidebar-navigation-screen-patterns now pull getTemplateInfo/getTemplatePartIcon from core-data; restored a blockEditorStore import in editor/store/private-actions.js that the move had dropped.
  4. Trunk had independently added the wp-core-data style registration in client-assets.php, so that part is already present.

Testing done

  • core-data unit tests: 217 pass (incl. moved use-is-dirty, private-actions, private-selectors)
  • editor store selector tests: 145 pass
  • Lint: only pre-existing trunk warnings remain (verified 1:1 against trunk)
  • API docs regenerated (docs:api-ref)

Full editor/site-editor e2e (save flows, global styles save panel) still worth a manual pass.

@github-actions github-actions Bot added [Package] Core data /packages/core-data [Package] Editor /packages/editor [Package] Edit Site /packages/edit-site labels Jul 20, 2026
The move commit added @wordpress/global-styles-engine to core-data's
package.json but package-lock.json was not updated to match, causing the
build's dependency-sync check to fail. Add the missing lock entry.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@youknowriad youknowriad left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For me this is a one of the two good paths forward, so I'm approving.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Moves the “entities saved states” UI and related save/template helpers out of @wordpress/editor into @wordpress/core-data, exposing them via core-data private APIs while keeping editor re-exports for backwards compatibility.

Changes:

  • Relocates EntitiesSavedStates (and hook) plus related styles into core-data, and wires saveDirtyEntities as a core store private action.
  • Switches editor/edit-site consumers to read getTemplateInfo / getTemplatePartIcon (and EntitiesSavedStates) from core-data private APIs.
  • Updates core-data build deps/TS refs and adjusts private API documentation.

Reviewed changes

Copilot reviewed 27 out of 32 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/editor/src/utils/index.js Stops re-exporting getTemplatePartIcon from editor utils.
packages/editor/src/style.scss Removes entities-saved-states styles from editor bundle.
packages/editor/src/store/selectors.js Switches template helpers to core-data private APIs.
packages/editor/src/store/private-selectors.js Switches template icon helper to core-data private APIs; removes meta-change selector.
packages/editor/src/store/private-actions.js Removes saveDirtyEntities from editor private actions (moved to core-data).
packages/editor/src/private-apis.js Removes EntitiesSavedStatesExtensible and template helper from editor private APIs.
packages/editor/src/components/save-publish-panels/index.js Uses core-data private EntitiesSavedStates instead of editor component import.
packages/editor/src/components/post-excerpt/panel.js Uses core-data private getTemplateInfo instead of editor util.
packages/editor/src/components/post-card-panel/index.js Uses core-data private getTemplateInfo instead of editor util.
packages/editor/src/components/index.js Re-exports EntitiesSavedStates + hook from core-data private APIs for back-compat.
packages/editor/src/components/document-bar/index.js Uses core-data private getTemplateInfo instead of editor util.
packages/editor/README.md Regenerates API docs; EntitiesSavedStates + hook now show “Undocumented declaration.”
packages/edit-site/src/components/sidebar-navigation-screen-patterns/index.js Switches template-part icon helper to core-data private APIs.
packages/edit-site/src/components/save-panel/index.js Switches entities-saved-states imports/unlocks from editor to core-data.
packages/edit-site/src/components/save-button/index.js Dispatches saveDirtyEntities from core store; reads dirty-state hook from core-data private APIs.
packages/edit-site/src/components/editor/use-editor-title.js Switches template helper unlock from editor to core-data private APIs.
packages/core-data/tsconfig.json Adds TS project references needed by moved component/utilities.
packages/core-data/src/utils/test/get-template-info.js Adds unit tests for the moved getTemplateInfo helper.
packages/core-data/src/utils/get-template-part-icon.js Adds moved getTemplatePartIcon helper.
packages/core-data/src/utils/get-template-info.js Adds moved getTemplateInfo helper (currently needs a guard/defaults fix).
packages/core-data/src/style.scss Adds core-data stylesheet entry for entities-saved-states styles.
packages/core-data/src/private-apis.ts Exposes moved component/hook/utils via core-data private APIs.
packages/core-data/src/private-actions.js Adds saveDirtyEntities to core-data private actions.
packages/core-data/src/components/entities-saved-states/test/use-is-dirty.js Updates tests after moving hook into core-data.
packages/core-data/src/components/entities-saved-states/style.scss Adds entities-saved-states styles under core-data.
packages/core-data/src/components/entities-saved-states/index.js Moves EntitiesSavedStates + extensible variant into core-data.
packages/core-data/src/components/entities-saved-states/hooks/use-is-dirty.js Updates hook to select from STORE_NAME instead of importing core-data store object.
packages/core-data/src/components/entities-saved-states/entity-type-list.js Updates entity list to select from STORE_NAME.
packages/core-data/src/components/entities-saved-states/entity-record-item.js Updates template-title lookup to use moved getTemplateInfo and core store selectors.
packages/core-data/package.json Adds dependencies required by the moved component/utilities (components/icons/notices/etc, clsx).
package-lock.json Lockfile update for the core-data dependency additions.
docs/private-apis.md Documents new core-data private exports (needs follow-up doc accuracy fixes).
Comment thread docs/private-apis.md
Comment on lines 193 to 198
Private exports:
- `EntitiesSavedStates`
- `EntitiesSavedStatesExtensible`
- `getTemplateInfo`
- `getTemplatePartIcon`
- `useEntityRecordsWithPermissions`
Comment thread packages/editor/README.md
Comment on lines 374 to 377
### EntitiesSavedStates

Renders the component for managing saved states of entities.

_Parameters_

- _props_ `Object`: The component props.
- _props.close_ `Function`: The function to close the dialog.
- _props.renderDialog_ `boolean=`: Whether to render the component with modal dialog behavior.
- _props.variant_ `string`: Changes the layout of the component. When an `inline` value is provided, the action buttons are rendered at the end of the component instead of at the start.

_Returns_

- `React.ReactNode`: The rendered component.
Undocumented declaration.

@youknowriad youknowriad added the [Type] Performance Related to performance efforts label Jul 22, 2026
@enejb
enejb marked this pull request as ready for review July 22, 2026 16:55
@github-actions

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: youknowriad <youknowriad@git.wordpress.org>
Co-authored-by: enejb <enej@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@youknowriad
youknowriad merged commit 164a505 into WordPress:trunk Jul 23, 2026
53 of 54 checks passed
@github-actions github-actions Bot added this to the Gutenberg 23.7 milestone Jul 23, 2026
@enejb
enejb deleted the rebase/entities-saved-state-core-data branch July 23, 2026 16:29

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file was moved but not all of its dependencies were moved. @wordpress/base-styles needs to be declared.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Core data /packages/core-data [Package] Edit Site /packages/edit-site [Package] Editor /packages/editor [Type] Performance Related to performance efforts

4 participants