Skip to content

Extend server-side preresolution to post/term/attachment/link value previews and titles #9

Description

@mejta

Context

Since lazy field data loading (v4.10.0, see docs/adr/0001-viewport-gated-data-loading.md), fields only fetch remote data once visible. Async select/multi_select fields still display their stored value's label immediately without any request, because OptionsIntegration::build_preresolved_options() embeds a value→label map in data-preresolved-options during page render.

post, term, attachment, link, and direct_file fields have no equivalent, so:

  • their stored value's preview (post title/thumbnail, term name, attachment thumbnail, URL title, file info) is invisible until the field scrolls into view and latches;
  • collapsed multi_group item headers whose title derives from such a field show the #1, #2, … fallback until the row is expanded (children of collapsed rows are display: none, never intersect, never latch).

Proposal

Extend the preresolution pattern to these types: during prepare_items_for_js(), resolve the stored values server-side (post title/permalink/thumbnail, term name, attachment metadata, …) and embed them alongside the existing preresolved options map. The field components then seed their display state from the embedded data the same way useSelectedOptionLabels seeds from preresolvedOptions, eliminating both the visible preview gap and the collapsed-row title fallback with zero extra requests.

Notes

  • Deliberately deferred from the lazy-loading work — see the "Consequences" section of ADR 0001 for why latching collapsed-row children on header visibility was rejected.
  • Watch payload size on pages with many stored relations; only resolve what page render already loads cheaply.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions