Standardize 'sat' vs 'sats' currency string end-to-end #70
Labels
No labels
app:activities
app:chat
app:events
app:forum
app:libra
app:market
app:restaurant
app:tasks
app:wallet
app:webapp
bug
enhancement
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
aiolabs/webapp#70
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The webapp uses
'sat'and'sats'interchangeably across modules — same concept, two different string literals. Every comparison defensively handles both, which is workable but accumulates dead bytes and creates real bugs when someone writes a strict comparison.grep -rn "['\"]sat['\"]\|['\"]sats['\"]" src/returns ~85 matches. Sampler:src/modules/activities/services/TicketApiService.ts:293—getCurrencies()returns['sats', ...](plural)src/modules/activities/components/CreateEventDialog.vue:123— schema default'sat'(singular)src/modules/activities/components/CreateEventDialog.vue:166— initialValues'sat'src/modules/market/services/nostrmarketAPI.ts:456,459— fallback['sat']src/modules/market/types/market.ts:57— default'sats'src/modules/market/components/ProductCard.vue:234,CartItem.vue:246,ShoppingCart.vue:242,CartSummary.vue:226,CheckoutPage.vue:525,ProductDetailPage.vue:199— defensive comparisonscurrency === 'sat' || currency === 'sats'PR #68 hit a real bug from this: introducing a
currency === 'sat'conditional onCreateEventDialogworked locally with the schema default but failed as soon as the user picked from the populated dropdown (which contains'sats'fromgetCurrencies()). Patched with the same defensive'sat' || 'sats'pattern, but that's a workaround.Proposed approach
'sats'(plural) is more common across the codebase + matches what bothevents.getCurrencies()andnostrmarketreturn from the LNbits backends, so the conversion direction is "schema/UI catches up to backend." Open to'sat'if there's a reason — but pick one.|| 'sat') → canonicalize.currency === 'sat' || currency === 'sats'collapse to a single comparison.'sats'; double-check before tightening the webapp comparisons.Out of scope for this issue
100 satsvs100 sat) is a separate UX question — this issue only covers the identifier string used in code comparisons / API payloads.Why now
Cleaning this up unblocks future strict-from-the-start conditionals (the v2 / pre-launch policy applies — backwards-compat shims like the defensive comparison are the explicit thing we want to avoid carrying forward). The longer this lingers the more new code will accrete the same
||pattern.