Skip to content

fix: plugin price display#2120

Merged
deadlyjack merged 3 commits into
mainfrom
ajit/fix-plugin-page
May 20, 2026
Merged

fix: plugin price display#2120
deadlyjack merged 3 commits into
mainfrom
ajit/fix-plugin-page

Conversation

@deadlyjack
Copy link
Copy Markdown
Member

No description provided.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 20, 2026

Greptile Summary

This PR fixes plugin price display by replacing the hardcoded Indian Rupee symbol () with a dynamic currencySymbol field sourced from the API response. Both the plugin detail page and the plugin list item component are updated consistently.

  • plugin.js: The price string is now assembled with ${remotePlugin.currencySymbol ?? \"\"}${remotePlugin.price}, falling back to an empty string when currencySymbol is absent. When IAP is available the price is later overwritten by product.price, which already carries the locale-correct formatted string from the store.
  • item.js: currencySymbol is destructured as a new prop, added to the JSDoc, and rendered alongside price in JSX; {undefined} in JSX renders nothing, so missing symbols degrade silently and safely.

Confidence Score: 5/5

Safe to merge — both changed files handle the dynamic currency symbol correctly with no crash paths.

The change is a narrow, well-scoped fix: the hardcoded rupee symbol is replaced with an API-supplied field, the nullish-coalescing fallback in plugin.js prevents broken strings when the field is absent, and JSX's natural handling of undefined keeps item.js safe. IAP-enabled platforms overwrite the price with the store's own formatted string, so there is no double-symbol risk there.

No files require special attention.

Important Files Changed

Filename Overview
src/pages/plugin/plugin.js Replaces the hardcoded rupee prefix with a dynamic ${remotePlugin.currencySymbol ?? ""}${remotePlugin.price} template; nullish-coalescing fallback handles missing symbol safely.
src/pages/plugins/item.js Adds currencySymbol as a separate prop (with JSDoc), renders it alongside price in JSX — JSX drops undefined cleanly, so no crash if the API omits the field.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[API Response] --> B{currencySymbol present?}
    B -->|Yes| C["price = currencySymbol + price\ne.g. '$9.99'"]
    B -->|No| D["price = '' + price\ne.g. '9.99'"]
    C --> E{IAP Available?}
    D --> E
    E -->|Yes| F["price = product.price\n(store-formatted string)"]
    E -->|No| G[Use assembled price string]
    F --> H[plugin.view.js renders price]
    G --> H
    A --> I["plugins.js: Item {...plugin}"]
    I --> J{currencySymbol in spread?}
    J -->|Yes| K["Renders: {currencySymbol}{price}"]
    J -->|No| L["Renders: {price} only\n(undefined silently dropped)"]
Loading

Reviews (2): Last reviewed commit: "fix: currency rendering" | Re-trigger Greptile

Comment thread src/pages/plugin/plugin.js Outdated
isPaid = remotePlugin.price > 0;
purchased = remotePlugin.owned;
price = `${remotePlugin.price}`;
price = `${remotePlugin.currencySymbol}${remotePlugin.price}`;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Missing fallback for undefined currencySymbol

If remotePlugin.currencySymbol is undefined or null (e.g., the field is absent from the API response), the template literal produces the literal string "undefined100" or "null100", which gets rendered verbatim in the plugin detail UI. On non-IAP platforms the IAP code path never runs to overwrite price, so this broken string persists. A nullish-coalescing fallback makes it safe: `${remotePlugin.currencySymbol ?? ""}${remotePlugin.price}`.

@deadlyjack
Copy link
Copy Markdown
Member Author

@greptile_apps review

@deadlyjack deadlyjack merged commit 4cb88bd into main May 20, 2026
9 checks passed
@deadlyjack deadlyjack deleted the ajit/fix-plugin-page branch May 20, 2026 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant