docs: corrections and pitfalls from AI builder field notes#6775
docs: corrections and pitfalls from AI builder field notes#6775amsraman wants to merge 3 commits into
Conversation
Upstreams doc gaps found while reconciling Reflex Build's curated knowledge base against these pages: - upload: rx.get_upload_url returns a frontend Var, not str (bug fix); upload id must be a literal; handler/trigger placement pitfalls; uploading-from-a-form guidance; avoid hardcoding /_upload/ paths - drag-and-drop: memo params are Vars; on_drag_start unsupported; nested drop dedupe + root-level drops; collected-params naming with _collected_params example; don't add a second provider - shared_state: token sanitization; _link_to pitfalls; computed var placement - lifespan_tasks: lifespan task vs background event decision guidance - markdown: escaping literal dollar signs (LaTeX delimiter) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Merging this PR will not alter performance
Comparing Footnotes
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 021e99e9f3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| - **Type**: Returns `str` | ||
| - **Type**: Returns a frontend `Var` (a JavaScript expression), not a Python `str` | ||
|
|
||
| Because it returns a frontend Var, `rx.get_upload_url` is frontend-only: use it in component code and event triggers, not in backend event handlers or computed vars, where the value would not resolve to a usable string. If you genuinely need the upload URL as a plain string on the backend, construct it from `self.router.headers.host` instead. |
There was a problem hiding this comment.
Use the configured upload endpoint for backend URLs
When users follow this backend fallback in deployments with backend_path or a separately served API, building from self.router.headers.host omits the configured upload prefix and scheme that get_upload_url gets from getBackendURL(env.UPLOAD) and that the server mounts via config.prepend_backend_path(str(Endpoint.UPLOAD)). This can produce links that work locally but 404 in prefixed/split frontend-backend deployments; point backend-only examples at the configured upload endpoint (for example Endpoint.UPLOAD.get_url() plus the filename) instead of the Host header.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in ac11db3 — the backend note now points at Endpoint.UPLOAD.get_url() joined with the filename instead of the Host header.
Greptile SummaryThis PR adds documentation corrections and pitfall callouts across five pages, sourced from real-world failures observed in Reflex Build's AI builder. The changes fix a stale return-type claim for
Confidence Score: 5/5Safe to merge — all changes are documentation only with no runtime code touched. All five files are Markdown documentation pages. The content additions are accurate, well-scoped, and consistent with the existing doc voice. The only finding is a missing stability caveat and join-syntax example for an internal API reference in upload.md, which does not affect any running code. docs/library/forms/upload.md — the Endpoint.UPLOAD.get_url() hint could be clarified with a stability note and a concrete join example. Important Files Changed
Reviews (3): Last reviewed commit: "docs: ruff-format the drag-and-drop exam..." | Re-trigger Greptile |
…ased backend URL, internal-API caveat Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
What
Five doc pages get corrections and pitfall callouts sourced from Reflex Build's curated knowledge base — rules our AI builder learned from real failures that turned out to be gaps (and in one case an error) in these pages. We're consolidating that knowledge base into the official docs so users and agents read the same source of truth (flexgen ENG-10044).
library/forms/upload.md— bug fix:rx.get_upload_urlwas documented as returningstr; it returns a frontendVarand is unusable in backend handlers/computed vars (backend alternative noted). Plus: uploadidmust be a string literal,file.namenote, handlers must not bebackground=True, the upload trigger button must live outside the dropzone, a short "Uploading from a Form" subsection (on_submitnever carries file data), and don't hardcode/_upload/paths.enterprise/drag-and-drop.md—@rx.memoparams are Vars (index /rx.foreach, no Python loops);on_drag_startdoesn't exist; nested drop targets fire once per layer (dedupe) + root-level drop pattern; assigncollected_paramsto a variable before reading fields, with a_collected_params=..._replace(_js_expr=...)example for multiple zones in one memo component; warning against adding a second DnD provider.state_structure/shared_state.md— sanitize tokens derived from query params (underscore restriction);_link_topitfalls (must await, use the returned instance, only exists onrx.SharedState); computed vars depending only on shared vars belong on the shared state.utility_methods/lifespan_tasks.md— a "Lifespan Tasks vs Background Events" decision section.library/typography/markdown.md— literal$pairs are parsed as LaTeX math (prices vanish, notably in streamed LLM output); escape beforerx.markdown.All additions follow each page's existing conventions (
md alertcallouts, demo blocks, doc voice). No behavioral claims were included that we couldn't verify against current reflex (e.g. we dropped a stale note aboutfile.filename— it exists as an alias of.name).🤖 Generated with Claude Code