Docs: fix broken examples and fill documentation gaps#12
Merged
Conversation
- websockets: the flagship first example used useWebSocket(window.location.pathname) — window is evaluated during SSR, so copy-pasting the guide's opening example 500'd the page. Now uses the SSR-safe route-param form, with a callout explaining hook arguments evaluate during SSR. - pyxle-db: the end-to-end example read request.json["title"] (request.json is an async method -> 500 "'method' object is not subscriptable"); now awaits it, consistent with Server Actions. - pyxle-auth: documents that /auth/* POST endpoints are CSRF-protected (cookie + X-CSRF-Token header, useAuth() handles it automatically) with a working curl example, and that a SQLite DB auto-creates at data/app.db on first run + how to point at a production database. - cli: honest scope caveat for 'pyxle check' (validates syntax and semantics; does not prove a page renders) + note that the JSX check ships by default as of 0.7.0. - introduction: Prerequisites callout (Python 3.10+, Node 18+); stale hardcoded 'Current version: 0.5.0' lines removed from introduction/README (drift trap — changelog carries the version). Suite: 2183 passed, coverage 96.49%. Adversarially reviewed (approve).
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 several documentation issues found while testing the guides end-to-end:
window.location.pathnametouseWebSocket()— evaluated during server rendering, wherewindowdoesn't exist, so copy-pasting the example failed the page. It now derives the socket path from route data, with a callout explaining that hook arguments are evaluated during SSR.request.jsonwithout awaiting it (it's an async method); now usesbody = await request.json(), consistent with the Server Actions page./auth/login,/auth/signup,/auth/logout) are CSRF-protected like every state-changing POST, but the page never said so — a new CSRF subsection explains the double-submit flow with a working curl sequence, and notesuseAuth()handles it automatically.data/app.db, and how to point at a production database.pyxle check: a green check validates syntax and semantics; runtime-only mistakes (like a component reading a loader key that doesn't exist) surface when the page loads.