Core Data: Support reading revision data in useEntityProp (fixes footnotes in revisions UI)#76106
Core Data: Support reading revision data in useEntityProp (fixes footnotes in revisions UI)#76106
Conversation
|
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Size Change: +151 B (0%) Total Size: 6.87 MB
ℹ️ View Unchanged
|
The footnotes block always showed the current post's footnotes when viewing a revision, instead of the revision's footnotes. Fix this by adding a `revisionId` prop to `EntityProvider` that causes `useEntityProp` to read from the cached revision record instead of the current entity record. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
5a74be0 to
ae81cce
Compare
|
Flaky tests detected in ae81cce. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/22641108049
|
There was a problem hiding this comment.
Still need to do proper testing (working on it now), but wanted to share some questions/thoughts.
Update
Experience looks better. I was expecting diff view, until I remembered it only works for RichText fields. Users might have the same expectations.
It would be helpful to get more opinions before we commit to this. cc @WordPress/gutenberg-core
Screencasts
Before
CleanShot.2026-03-04.at.15.33.38.mp4
After
CleanShot.2026-03-04.at.15.32.37.mp4
| kind, | ||
| name | ||
| ); | ||
| const revKey = entityConfig?.revisionKey || 'id'; |
There was a problem hiding this comment.
Nit (non-blocking): It's probably better to use DEFAULT_ENTITY_KEY for consistency.
| <CanvasContent showDiff={ showDiff } /> | ||
| </div> | ||
| </ExperimentalBlockEditorProvider> | ||
| <EntityProvider revisionId={ currentRevisionId }> |
There was a problem hiding this comment.
It took me a moment to realize that kind, name and id will be inherited from the parent context. It might be worth documenting this in a separate issue. This is mostly a note for myself.
| revision: getCurrentRevision(), | ||
| previousRevision: getPreviousRevision(), | ||
| postType: getCurrentPostType(), | ||
| currentRevisionId: getRevisionId(), |
There was a problem hiding this comment.
I think we already have this data as part of the revision object.
I had commented on this in the PR description, I'll look into this as a follow up so the there's no distraction to this fix |
… access - Use `DEFAULT_ENTITY_KEY` instead of hardcoded `'id'` in useEntityProp - Use `revision.id` from the already-fetched revision object instead of a separate `getCurrentRevisionId` selector call - Add comment clarifying EntityProvider inherits kind/type/id from parent Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
core/footnotesblock always showed the current post's footnotes when viewing a revision in the revisions UI, instead of the revision's footnotesrevisionIdprop toEntityProviderthat gets stored inEntityContextuseEntityPropdetectsrevisionIdin context, it reads from the cached revision record (viagetRevisions()) instead of the current entity, and makes the setter a no-opRevisionsCanvaswith<EntityProvider revisionId={currentRevisionId}>so blocks inside the preview read revision-specific dataTest plan
npm run test:e2e -- test/e2e/specs/editor/various/footnotes-revisions.spec.js🤖 Generated with Claude Code