Live Preview on new entries breaks tags that rely on an entry id

オープン
#15,734 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
laravel, php

調査の方向性

Start by tracing the Live Preview create flow introduced in #15648 and how the listed tags resolve entry context and structure; inspect the create preview route to understand why Pop out returns a 404. Reproduce with a new entry in a structured collection using the provided collection:next template, then check each listed tag and descendants()/in() behavior. Done means those tags handle unsaved entries without errors or unrelated results, and Pop out works from the create form.

索引モデルが issue の本文から書いたものです。

説明

live preview
Bug description

Since #15648 (6.38.0) you can open Live Preview while creating an entry.

That entry isn't saved yet, so it has no id and isn't in the structure tree. Some core tags expect both and blow up in the preview:

  • collection:next / previous / older / newer: "Call to a member function collection() on null"
  • children, and nav with from="..." on structured collections: "Call to a member function pages() on null"
  • locales:count with all="true": "Call to a member function blueprint() on null"

Also:

  • descendants() and in() on the new entry return unrelated entries, because they query for entries without an origin.
  • Pop out on the create form opens a 404, because the create preview route is POST-only.
How to reproduce
  1. Add {{ collection:next }}{{ title }}{{ /collection:next }} to a template of a structured collection.
  2. Create Entry -> Live Preview.
  3. 💥
Logs

Environment
6.38.0
Installation

Fresh statamic/statamic site via CLI

Additional details

No response

主要言語
PHP
スター
4.9k
フォーク
647
平均マージ
1日 45分
マージ済み PR(30日)
221

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

statamic/cms のほかの issue

statamic/cms の issue をすべて見る

似ている issue

PHP の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。