Repository navigation
Conversation
When a navigation link switches to an entity type whose record isn't loaded yet (for example, a page link changed to a category), the URL binding returns no URL until the record request finishes. The Link UI treated the link as empty in the meantime: it showed "No link selected", brought back the "Create page" and "Add block" tools, and swapped the title for the page's HTML title from the rich preview. `useEntityBinding` now reports `isBoundEntityPending` from the record's resolution state, which tells a loading record apart from a deleted one. While it is pending, the Link UI uses the URL stored on the block and the link label as the entity title. This makes the taxonomy-only URL fallback in LinkControl unnecessary, so it is removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013RXB2AJtSuC5Gdi1ZUy8wf
🤖 PR meta 🤖📦 Bundle sizeSize Change: -29 B (0%) Total Size: 8.25 MB 📦 View Changed
⚡ PerformanceShow the resultsClient side metrics exclude the server response time. front-end-block-theme
front-end-classic-theme
media-processing
media-upload
post-editor
site-editor
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
Follow up to #83408.
Keeps the Link UI showing the selected link while the record for a newly bound entity is still loading, instead of briefly treating the link as empty.
Why?
Since #83408, a navigation link can be pointed at an entity of another type, for example a page link changed to a category. The URL is bound to the entity (
core/term-dataorcore/post-data), and the binding has no URL until that entity's record loads. Pages are usually already in the store, but categories, tags and other types are not, so after selecting one the Link UI briefly:It then corrected itself once the record request finished, so the wrong state lasts as long as that request.
How?
useEntityBindingreturns a newisBoundEntityPendingflag, true whilehasFinishedResolution( 'getEntityRecord', … )is false for the bound record. This tells a loading record apart from a deleted one, so a deleted entity still shows as missing.getBlockAttributes( clientId ).url) and the link label as the entity title. Once the record loads, the bound value takes over as before.entityUrlFallbackRef/previewValueworkaround, which only covered taxonomy links, is removed. Its TODO asked for removal once the binding returns a URL while resolving, which the Link UI now provides.The inspector sidebar's "Link to" preview also uses
useLinkPreviewwith the bound URL and may show the same brief state. It is not changed or tested here.Testing Instructions
Automated coverage:
navigation.spec.jsholds the category request open and checks the preview during and after the wait. It fails on trunk and passes here.isBoundEntityPendinginuse-entity-binding.jsdom.test.js: loading, loaded, deleted, no binding, and thetag→post_tagmapping.Testing Instructions for Keyboard
Use of AI Tools
This PR was written with Claude Code (Claude Opus 5.5): debugging the in-between state with a diagnostic e2e trace, writing the tests and the fix. I reviewed the changes.
🤖 Generated with Claude Code
https://claude.ai/code/session_013RXB2AJtSuC5Gdi1ZUy8wf