Repository navigation
fix(handout): resolve real product names on the printable handout - #31
Merged
Merged
Conversation
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.
Summary
The printable handout (
/apps/protocols/<token>?handout=1) showed "Item 1" and "Item 2" instead of product names, because protocol lines stored in Postgres hold onlyvariantGid,productHandle,quantityandusageNote(Spike S6 Option A) and the handout was static HTML with no hydration. The client page already hydrates names in the browser from/products/<handle>.js; the handout now does the same.Changes
app/lib/protocols/handout.jsproductHandle, and "Unavailable product" otherwise (never "Item N").data-product-handle,data-variant-idanddata-variant-gidon eachtr.line-row./products/<handle>.json the storefront origin, matches the variant, sets the title, and shows an "Out of stock" or "Unavailable product" badge with strikethrough styling when relevant.onclick, so one click now opens one print dialog. The handler waits for hydration (rejections are caught) and uses an in-flight flag to ignore rapid repeat clicks.escapeHtmlstays on every interpolated value.app/lib/protocols/routes.js:/apps/protocols?handout=1without a token now returns 404.Verification
npm test: 599 passing, 0 failing.onclick, exactly onewindow.print(call site, and no{{,}},{%or%}anywhere in the output (the page is served asapplication/liquid).variantResolver: undefined), unavailable variants, cross-shop token returns 404, missing token returns 404./products/*.jsresponses: names resolved, unavailable and out-of-stock rows badged, one click gave one print call, a rapid double click gave one, and failed fetches still printed once.Known limitations
/products/<handle>.jsrequest never returns, the Print button waits on it (follow-up: cap the wait at about 3 seconds).Constraints
read_ordersonly), no new database columns, no stored title snapshots, no client-identifying data, no new dependencies.