Skip to content

perf: defer unused nested rich-text schemas and reuse client conversions - #18474

Open
Stevemoretz wants to merge 2 commits into
payloadcms:3.xfrom
Stevemoretz:perf/nested-richtext-client-schemas
Open

Stevemoretz wants to merge 2 commits into
payloadcms:3.xfrom
Stevemoretz:perf/nested-richtext-client-schemas

Conversation

@Stevemoretz

@Stevemoretz Stevemoretz commented Oct 3, 2026 •

Copy link
Copy Markdown

Nested rich-text editors expand into millions of schema paths. Eager server traversal blocks the event loop; client conversion and feature serialization duplicate shared definitions.

This change reuses conversions by object identity within one context, defers declared native editor schemas until lookup, and gives native blocks/link/upload clients their declared schema roots. Custom features without declared keys retain eager generation and full descendant maps. Ordinary Map callers retain native traversal. Enumeration preserves insertion order; overrides, deletion/reinsertion and clear are covered. No schema paths or stored documents change.

Validation:

  • 14 focused Vitest tests pass for conversion isolation, lazy lookup, insertion order/mutations, and native/custom feature compatibility.
  • The equivalent installed-package regressions pass in a downstream app.
  • Full local Next Turbopack production build passes.
  • Real browser checks pass for four editor collections, link rel editing, dynamic inline fields, nested table rows, draft save/reload and a two-version diff under a 2 GiB heap cap.
  • In the downstream schema fixture, eager server-map generation blocked a timer for approximately 5.2 seconds; deferred server plus client map construction took approximately 122 ms. Retained heap after the editor matrix was approximately 946 MiB (previous measurement approximately 1.54 GiB). These are downstream fixture measurements, not general Payload benchmarks.

Ready for maintainer review. The complete Payload workspace integration/browser matrix has not been run locally and still needs upstream CI validation before merge. Full enumeration still materializes the map, and admin rendering can still occupy the event loop; this does not claim hard real-time isolation for colocated WebSockets.

@Stevemoretz Stevemoretz changed the title perf: avoid eager duplication of nested rich-text client schemas perf: defer unused nested rich-text schemas and reuse client conversions Oct 3, 2026
@Stevemoretz
Stevemoretz marked this pull request as ready for review October 3, 2026 15:33

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant