Skip to content

docs: stop the tutorial's preview step from crashing before the draft loads - #2707

Merged
josephfusco merged 5 commits into
canaryfrom
docs/2704-tutorial-preview-crash
Oct 29, 2026
Merged

josephfusco merged 5 commits into
canaryfrom
docs/2704-tutorial-preview-crash

Conversation

@josephfusco

@josephfusco josephfusco commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

Fixes #2704

Moving the loading check fixed the reported crash, but testing a brand-new draft (the issue's repro) showed a second crash once loading finished: a never-published draft has no permalink, so the URI lookup returned null. The tutorial now looks the post up by databaseId, like the getting-started example. Tested in a local copy of the tutorial app (WordPress 7.1.3, @faustwp/core 3.6.0): previews of a new draft and of the published Hello World post both render, with both the preview-step and Blocks-step listings; canary's listing crashes on both.

Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Assisting with tracing the preview data flow, editing the tutorial, and testing it end to end in a local tutorial app.

…view step

Draft previews render in the browser, so props.data is undefined on the
first render and reading props.data.post first crashed the preview.
The full SingleTemplate listing in the Blocks section still read
props.data.post before the loading check, so previews crashed there too.
The step-by-step snippet doesn't log each block, so the full listing
didn't match what readers had typed.
@josephfusco josephfusco added [Type] Documentation Documentation to be added or enhanced [Area] Core Issues for the @faustwp/core package labels Oct 27, 2026
@josephfusco
josephfusco marked this pull request as ready for review October 27, 2026 15:53
@josephfusco
josephfusco requested review from a team and colinmurphy as code owners October 27, 2026 15:53
A post that has never been published has no permalink, so the URI
lookup returned null and the preview crashed once loading finished.
Tested by previewing both a new draft and the published Hello World
post in a local copy of the tutorial app.

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.

🟢 Approval recommended

The updated examples consistently guard loading-time data access and use Faust’s seed-query database ID, with no unresolved issues.

No open issues 🎉

What changed in this PR

Updates the Learn Faust tutorial to fix draft-preview crashes reported in #2704 and keep the preview and Blocks examples consistent.

Changes:

  • Moves loading checks before post data access.
  • Replaces URI lookups with database ID lookups to support never-published drafts.
  • Updates the instructions and removes a debug log from the Blocks example.
File Description
docs/​tutorial/​learn-faust/​index.md Corrects loading guards and post lookups in the tutorial’s preview and Blocks examples.

Review effort: Balanced

@josephfusco
josephfusco merged commit e0b413f into canary Oct 29, 2026
6 checks passed
@josephfusco
josephfusco deleted the docs/2704-tutorial-preview-crash branch October 29, 2026 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Area] Core Issues for the @faustwp/core package [Type] Documentation Documentation to be added or enhanced

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Learn Faust tutorial: preview step crashes with "Cannot read properties of undefined (reading 'post')"

2 participants