Repository navigation
fix(editor): support template and field query params and prefill (#75) - #138
Conversation
anurag629
left a comment
There was a problem hiding this comment.
Thanks @bhushan4work, the editor part works. I ran it on top of dev in headless Chrome: ?template=quote-centered-serif opens Centered Serif (also from /create/blog), ?title=Hello&description=World fills both fields, an unknown template id or key is ignored, ?autofill= opens Smart Autofill with the URL in it, edits stay after that, and the console has no hydration warnings. On dev the same links still open Minimal Dark. npm run check, all 483 tests and the build pass.
Three things before I merge:
- The README line still says you can "share or bookmark any configuration". Nothing writes the editor state back to the URL, so a bookmark taken after editing loses the edits. I left a suggestion for that line below.
- Please drop the "README.md:33 accuracy" test and the "gallery cards link to /create?template=id" test. The first one pins line 33 of the README word for word, so any edit above that line breaks it. The second builds the link inside the test, so it passes whatever
templates.astrodoes. - A value that isn't a number goes through as a string for number fields.
/create?template=ecommerce-product-card&rating=abcputs"abc"inrating, the slider shows NaN and React logs "Received NaN" twice. Can you skip values whereNumber.isFiniteis false, in both branches ofparseEditorQueryParams, and add a test for it?
| - **Social Preview Checker**: Paste any URL to analyze its meta tags and see platform previews | ||
| - **Client-side Rendering**: Satori runs in the browser for instant preview during editing. Zero server calls while editing. | ||
| - **URL-based State**: All editor state is encoded in URL params — share or bookmark any configuration | ||
| - **URL-based State**: Prefill editor state via URL params — share or bookmark any configuration |
There was a problem hiding this comment.
| - **URL-based State**: Prefill editor state via URL params — share or bookmark any configuration | |
| - **Prefill from the URL**: Links like `/create?template=quote-centered-serif"e=Hello` open the editor with that template and text filled in |
anurag629
left a comment
There was a problem hiding this comment.
Thanks @bhushan4work, that's everything. /create?template=ecommerce-product-card&rating=abc now keeps the default rating and the console stays clean, the template links still open the right template, and the README line reads right. npm run check, all 482 tests and the build pass. Merging.
Closes #75
Description
titleanddescription.?autofill=.How I Tested This
npm run checknpm run test/createand/create/{category}usingnpm run dev.AI Assistance
none
Type of Change
Screenshots
Not applicable; no visual changes.
Checklist
devnpm run checkpassesnpm run testpassesnpm run dev