Skip to content

feat(dot-page-api): add depth parameter handling in DotPageApiService#36412

Open
KevinDavilaDotCMS wants to merge 2 commits into
mainfrom
36410-uve-rest-page-fetch-omits-depth-param-relationship-fields-come-back-undefined-in-edit_mode-headless-and-traditional
Open

feat(dot-page-api): add depth parameter handling in DotPageApiService#36412
KevinDavilaDotCMS wants to merge 2 commits into
mainfrom
36410-uve-rest-page-fetch-omits-depth-param-relationship-fields-come-back-undefined-in-edit_mode-headless-and-traditional

Conversation

@KevinDavilaDotCMS

@KevinDavilaDotCMS KevinDavilaDotCMS commented Jul 2, 2026

Copy link
Copy Markdown
Member

Problem

UVE's REST page fetch stopped sending depth. Backend skips relationship expansion entirely without it. Headless clients got that incomplete data pushed into their iframe, crashing on undefined relationship fields.

Fix 1 — Restore depth on REST

Files: dot-page-api.service.ts, consts.ts

  • DotPageApiService.get() now always sends depth, defaulting to '0' — the exact value used before the Feb 2025 regression.
  • Explicit depth values still win.
  • Applies to traditional and headless (same method, one fix point).

Fix 2 — Don't push REST data to a headless iframe

File: edit-ema-editor.component.ts

  • The postMessage push to headless clients now waits for requestMetadata (the client's GraphQL query) to exist.
  • Traditional pages: untouched, they already exit before this check.
  • Self-healing: once CLIENT_READY arrives, the same effect re-fires and pushes correct GraphQL data.

Why both

Fix Protects
1 — depth default Traditional pages (always REST) + UVE's own editor UI
2 — gate the push Headless client, so it never sees REST data at all

Fix 2 doesn't replace Fix 1 — traditional never goes through Fix 2's check.

Tests

  • pnpm nx test portlets-edit-ema-portlet1310 passed, 0 failed.
  • Lint clean.
  • No dedicated test yet for Fix 2's gating — existing suite unaffected, follow-up if needed.

Known gaps

  • depth=0 resolves one relationship level only (matches historical behavior).
  • Not verified against a real production headless site (not available in this environment).

## Summary
Enhances the DotPageApiService to always include a depth parameter in API requests, ensuring relationship data is not omitted. Introduces a default depth value and allows explicit depth values to be passed by the caller.

## Changes
- Updated API request URLs in unit tests to include the depth parameter.
- Modified the get method to set a default depth if none is provided.
- Added a test case to verify that explicit depth values are respected.

Closes #XXXX (replace with relevant issue number if applicable)
@claude

claude Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Claude finished @KevinDavilaDotCMS's task in 1m 24s —— View job


Rollback-Safety Analysis ✅

  • Read docs/core/ROLLBACK_UNSAFE_CATEGORIES.md
  • Get full PR diff (git diff 9e59064e...2a918ad7)
  • Analyze diff against each unsafe category
  • Post result

Result: Safe to rollback.

This PR is a frontend-only (TypeScript/Angular) change, scoped to core-web/libs/portlets/edit-ema/portlet/:

  • consts.ts — adds a DEFAULT_PAGE_DEPTH = '0' constant.
  • dot-page-api.service.ts — sends depth: depth ?? DEFAULT_PAGE_DEPTH as a query param on REST page fetches instead of omitting it.
  • edit-ema-editor.component.ts — adds a guard so headless pages don't push a REST-sourced page asset into the iframe until a GraphQL-backed requestMetadata is available.
  • dot-page-api.service.spec.ts — test updates for the above.

None of the unsafe categories apply:

  • No runonce DB migration tasks, no schema/table/column changes (C-1, C-4, H-1, H-2, H-3, H-7).
  • No Elasticsearch mapping or reindex changes (C-2).
  • No contentlet_as_json model version bump (C-3).
  • No stored procedure/function changes (H-6).
  • No new Content Type field type (H-4).
  • No storage provider change (H-5).
  • No VTL viewtool contract change (H-8).
  • M-3 (REST/GraphQL contract) does not apply: the backend (ContentUtils.addRelationships) already accepts and handles the depth query param — this PR only restores the client's practice of always sending it (a regression fix from PR feat(SDK): Update SDK Library and UVE search bar to Use "personaId" Key  #31295), it doesn't introduce a new backend contract or change an existing response/request shape that N-1 wouldn't understand.
  • No OSGi interface changes (M-4), no push-publishing bundle format changes (M-2), no column type changes (M-1).

Rolling back to N-1 simply reverts to the (buggy) behavior of omitting depth, which is exactly what was already happening before this PR — no data, schema, or index incompatibility is introduced either direction.

Label applied: AI: Safe To Rollback

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

🤖 dotBot Review (Bedrock)

Reviewed 4 file(s); 0 candidate(s) → 0 confirmed, 0 uncertain (unverified, kept for review).

✅ No issues found after verification.


us.deepseek.r1-v1:0 · Run: #28627064421 · tokens: in: 9043 · out: 2155 · total: 11198 · calls: 4 · est. ~$0.024

## Summary
Enhances the EditEmaEditorComponent by introducing a check for client queries when rendering headless pages. This prevents REST-sourced page assets from being pushed into the iframe, ensuring that only GraphQL-backed updates are processed.

## Changes
- Added a  variable to determine if the client has a valid query.
- Implemented a conditional return to skip iframe content loading for headless pages without a client query.

This change improves the integrity of the content rendering process in headless scenarios.
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

❌ Linked Issue Needs Team Label

This PR is linked to issue #36410, but that issue has no Team : * label. Every linked issue must be owned by a team for tracking and triage.

How to fix this:

Apply a Team : * label to the linked issue (e.g., Team : Scout, Team : Platform, Team : Falcon, Team : Maintenance). Then push a new commit or edit the PR description to re-run this check.


This comment was automatically generated by the issue linking workflow

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

Labels

AI: Safe To Rollback Area : Frontend PR changes Angular/TypeScript frontend code

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

UVE REST page fetch omits "depth" param — relationship fields come back undefined in EDIT_MODE (headless and traditional)

2 participants