Repository navigation
fix(extension): price list, badge, empty and error states, labels - #1319
Conversation
The side panel orders in-stock offers first and marks sold-out, discontinued and bait rows (the lookup now flags bait offers), shows a short state for not-found and accessory pages, an error card with retry for failed lookups, and no 0.0 stars or 100% genuine without reviews. The badge and pill warn on a bait price and never say OK for an unchosen size or an accessory; labels are Vietnamese and the panel is labelled for screen readers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review of the previous commit: the opt-in crowd signal is sent whatever the lookup answered, as before (#1175); only the tab's latest lookup may set or clear its pill, badge and panel, so a late failure for an earlier product no longer clears the current one; an open side panel reloads when the page's lookup fails; a bait price shows the amber verdict style in the panel too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A network error used to throw before the opt-in crowd signal; the lookup now reports it as a status-less failure, so the signal is skipped there to keep what the extension sends unchanged (#1175). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
If your organization's extra usage balance is empty, an organization admin can add extra usage credits at claude.ai/admin-settings/usage. If its monthly spend limit was reached, an admin can raise it on the same page. If neither applies, contact Anthropic support.
Once extra usage is available, someone with write access to this repository can comment @claude review on this pull request to trigger a review.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 53 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
⏱️ Code Review completed (10 eligible files · 68,616 chars · 3 model call(s) · 3 PR unit(s))
Whole diff with bounded context at base 4eca23d / head 792c250.
✅ No verified defects
1 possible issue(s) could not be grounded in or verified against the snapshot source, so they are not published.
Context investigation was bounded to the explicitly requested snapshot paths.
Closes #1297
Closes #1298
Closes #1299
Closes #1300
Closes #1301
Closes #1302
Fixes from an audit of the browser extension (
apps/extension). Nothing changes what the extension collects or sends (#1175): the opt-in crowd signal is sent in exactly the cases it was before.What users see
implausiblyLowflag (additive), judged among in-stock offers as on the product page.?category=.aria-live="polite"), and the pill's accessible name includes the verdict. Full vi/en/cs support is feat(extension): vi, en and cs through chrome.i18n #1304.Code
apps/extension/src/sidepanel/panel-view.tsandapps/extension/src/verdict-display.ts, so the rendering and badge mapping are testable.apps/web/src/server/rate/extension.ts: the additive offer flag.?cat=(the server-builtcompareUrl) is fix(web): compare links with ?cat= open on smartphones #1303 / fix(web): compare links with ?cat= open on their category #1316.Tests
apps/extension/src/test-extension-pipeline.ts: offer order and marks, the cheapest tag, badge and pill per verdict, the not-found and accessory states and action links, error kinds and texts, empty reviews, labels and accessible names. Extension typecheck, lint, test and build pass, as do web typecheck, lint and test.Review
🤖 Generated with Claude Code
📌 TL;DR
This PR refactors the Rate.vn Chrome extension to improve error handling, UI accuracy, and accessibility. It introduces a new
panel-viewmodule for testable HTML rendering, implements race-condition guards for product lookups, and refines the display of price verdicts, offer availability, and review data.🎯 Type of Change
🔍 Changes Walkthrough
apps/extension/CHROMEWEBSTORE.mdapps/extension/src/background/service-worker.tsLookupOutcome(distinguishing success, HTTP errors, and network failures). Added a request counter to prevent race conditions where stale lookups overwrite fresh UI state. Updated badge logic to use the newresolveActionBadgehelper.apps/extension/src/content/content-script.tsresolvePillTheme. Added a generation counter to ensure only the latest page inspection renders the trust pill, preventing stale UI on single-page applications. Improved accessibility labels.apps/extension/src/sidepanel/panel-view.tsapps/extension/src/sidepanel/sidepanel.htmlaria-liveandaria-labelattributes for accessibility.apps/extension/src/sidepanel/sidepanel.tspanel-viewbuilders. Implemented specific error handling for lookup failures (showing retry buttons and specific error messages). Fixed action link rendering to avoid duplicates. Updated "not found" and "accessory" states to show appropriate UI.apps/extension/src/test-extension-pipeline.tspanel-viewlogic, including offer sorting, badge resolution, error classification, and HTML escaping.📊 Architectural Flow
sequenceDiagram participant CS as Content Script participant SW as Service Worker participant API as Rate.vn API participant SP as Side Panel CS->>SW: RATE_PRODUCT_DETECTED (signal) SW->>SW: Increment detectRequestCounter SW->>API: GET /lookup API-->>SW: Response (Data or Error) alt Lookup Success SW->>SW: Check if request is still latest SW->>CS: Send Data CS->>CS: Render Trust Pill (if latest) SW->>SP: Update Session Storage SP->>SP: Render Product Card (panel-view) else Lookup Failure (429, 500, Network) SW->>SW: Check if request is still latest SW->>CS: Send Error Status CS->>CS: Remove Trust Pill (if latest) SW->>SP: Update Session Storage (Error) SP->>SP: Render Error Card (panel-view) SP->>User: Show Retry Button end