Preview with new nodes

Created on 8 May 2025, 5 months ago

Problem/Motivation

The EntityUrl DataProducer in the GraphQL module assumes that the entity passed to it is always valid and has an ID. However, in some cases (like when using the same page preview on newly created nodes), this assumption can lead to an exception.

Steps to reproduce

  1. Enable and configure the same page preview for a node content type.
  2. Create a new node and preview it before saving.
  3. Observe that the query fails with a entity malformed exception

Proposed resolution

This patch adds a safeguard to the resolve() method of EntityUrl to return null if the passed entity does not have an ID.

🐛 Bug report
Status

Active

Version

4.10

Component

Code

Created by

🇧🇪Belgium britt.vanderlinden

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024