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

Abierto
#15,734 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
45/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
laravel, php

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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

Lenguaje dominante
PHP
Estrellas
4.9k
Forks
647
Merge medio
1 d 45 min
PR fusionados (30 d)
221

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de statamic/cms

Todos los issues de statamic/cms

Issues similares

Más issues de PHP

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.