Skip to content

Conversation

@giuscris
Copy link
Member

@giuscris giuscris commented Nov 25, 2025

This pull request improves the preview functionality in the PagesController by ensuring that pages are always rendered as published and non-cacheable during preview, while also preventing unintended side effects by restoring the original page state after rendering. The changes enhance the reliability and correctness of page previews.

Preview logic improvements:

  • The preview now explicitly sets the page to be published and non-cacheable before rendering, ensuring that the preview always reflects how the page would appear when live.
  • After rendering the preview, the original values for published and cacheable are restored to the page, preventing any accidental state changes that could affect subsequent operations. [1] [2]

Other minor adjustments:

  • The call to setValues on page fields now includes an explicit null as the second parameter, clarifying the method invocation.
@giuscris giuscris requested a review from Copilot November 25, 2025 00:15
@giuscris giuscris self-assigned this Nov 25, 2025
@giuscris giuscris added the enhancement New feature or request label Nov 25, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR enables previewing unpublished pages as if they were published by temporarily setting the page's published status to true and cacheable to false during preview rendering.

  • Stores and restores original page published and cacheable values to prevent side effects
  • Adds explicit null default parameter to setValues() for consistent field handling
  • Uses try-finally block to ensure original values are restored even on exceptions

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@giuscris giuscris marked this pull request as ready for review November 25, 2025 00:26
@giuscris giuscris merged commit ae69f8c into 2.x Nov 25, 2025
7 checks passed
@giuscris giuscris deleted the feature/preview-page-as-published branch November 25, 2025 00:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

2 participants