Repository navigation
docs: stop the tutorial's preview step from crashing before the draft loads - #2707
Merged
Merged
Conversation
…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
marked this pull request as ready for review
October 27, 2026 15:53
1 task done
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.
Contributor
There was a problem hiding this comment.
🟢 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 bydatabaseId, like the getting-started example. Tested in a local copy of the tutorial app (WordPress 7.1.3,@faustwp/core3.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.