Skip to content

Resolve renderlet parent document id from DocumentContext - #3994

Merged
robertSt7 merged 2 commits into
2025.4from
fix/renderlet-parent-document-editmode
Aug 27, 2026
Merged

Resolve renderlet parent document id from DocumentContext#3994
robertSt7 merged 2 commits into
2025.4from
fix/renderlet-parent-document-editmode

Conversation

@robertSt7

@robertSt7 robertSt7 commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

RenderletContent used useParams() to read the open document's id, but that hook only resolves inside the main app's router tree. The document editor canvas mounts editables in a separate React root (inside an iframe) with no router, so the id came back undefined there. This reads the id from DocumentContext instead, which is provided in both mounting locations, and makes parentDocumentId required to match the now-mandatory backend parameter.

Companion fix: pimcore/studio-backend-bundle#1999
Related: pimcore/service-operations#848

Test plan

  • Added a Jest test rendering RenderletContent with only DocumentContext (no router) and asserting parentDocumentId is sent
  • jest passes on the touched test file

Copilot AI commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

One or more custom setup steps configured for this repository failed during this Copilot code review run:

Install dependencies with Composer

Setup steps run before each review. If the review above is missing context, or no review was posted at all, the failing step above may be the cause. See the workflow run for failure details, fix your setup steps configuration, and re-request a review.

Note

You can configure setup steps for Copilot code review separately from Copilot cloud agent with a copilot-code-review.yml file. Read the docs for details.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates renderlet requests to resolve the parent document ID from DocumentContext, supporting iframe-mounted editables.

Changes:

  • Replaces router parameter lookup with document context.
  • Adds focused Jest coverage for router-independent rendering.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 3 comments.

File Description
renderlet-content.tsx Sources parentDocumentId from document context.
renderlet-content.test.tsx Tests context-derived API parameters.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 3 changed files in this pull request and generated no new comments.

Suppressed comments (1)

assets/js/src/core/modules/element/dynamic-types/definitions/document/editable/components/renderlet-editable/renderlet-content.test.tsx:14

  • The generated client contract is still optional (document-api-slice.gen.ts:375 declares parentDocumentId?: number). Typing this mock with that interface does not detect the drift—an optional field remains accepted—and the runtime assertion only verifies this component's current value. This contradicts the PR's required-parameter goal and the companion backend contract; keep the generated field required (or regenerate after the backend schema is available).
import { type DocumentRenderletRenderApiArg } from '@Pimcore/modules/document/document-api-slice.gen'

Copilot AI commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

One or more custom setup steps configured for this repository failed during this Copilot code review run:

Install dependencies with Composer

Setup steps run before each review. If the review above is missing context, or no review was posted at all, the failing step above may be the cause. See the workflow run for failure details, fix your setup steps configuration, and re-request a review.

Note

You can configure setup steps for Copilot code review separately from Copilot cloud agent with a copilot-code-review.yml file. Read the docs for details.

@ValeriaMaltseva ValeriaMaltseva left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@robertSt7 LGTM, let's merge it :)

RenderletContent used useParams() to read the open document's id,
but that hook only resolves inside the main app's router tree. The
document editor canvas mounts editables in a separate React root
(inside an iframe) that has no router, so the id came back undefined
there and the renderlet render request lost its parent document
context. Read the id from DocumentContext instead, which is provided
in both mounting locations.

Backport of #3994 (2026.2) onto 2025.4.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@robertSt7
robertSt7 force-pushed the fix/renderlet-parent-document-editmode branch from 393eb36 to 7cf158e Compare August 25, 2026 09:02
@robertSt7
robertSt7 changed the base branch from 2026.2 to 2025.4 August 25, 2026 09:04
@sonarqubecloud

Copy link
Copy Markdown

@jcPimcore jcPimcore modified the milestones: 2026.2.7, 2026.2.8 Aug 25, 2026
@robertSt7
robertSt7 merged commit ec83e51 into 2025.4 Aug 27, 2026
17 checks passed
@robertSt7
robertSt7 deleted the fix/renderlet-parent-document-editmode branch August 27, 2026 14:03
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 27, 2026
@robertSt7 robertSt7 modified the milestones: 2026.2.8, 2025.4.13 Sep 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants