hotfix(currency): disable switcher + reset non-UAH prefs (data mislabelling)#631
Merged
barach6662001-bit merged 1 commit intomainfrom Apr 24, 2026
Merged
Conversation
…to prevent data mislabelling PR #613 + #628 shipped a conversion layer that changes the currency LABEL but never multiplies by an exchange rate, so a value saved as 1000 UAH renders as '1000 USD' on the expenses page, which is a correctness bug and a potential data-integrity hazard once input-side conversion lands. Until the conversion layer is rebuilt: - Profile currency Select is disabled with a tooltip "Валютна конвертація в розробці, буде доступна найближчим часом". - On every currency-store `load()`, if the backend returned a preference other than UAH, we silently call updatePreferences('UAH') so stale USD/EUR settings do not keep mislabelling values on return visits. - setPreferredCurrency is hard-forced to UAH regardless of the argument, so any code path still invoking it cannot re-introduce a non-UAH state.
barach6662001-bit
added a commit
that referenced
this pull request
Apr 24, 2026
… input lock, switcher re-enable (#634) * feat(currency): rewrite useFormatCurrency with real rate conversion + <Money/> SSOT - hook signature: (amountUah, date?|options?) => string, divides by rateToUah - null/undefined/NaN -> '—', UAH passthrough, warn-once on empty rates - <Money/> single source of truth with nullText, tabular, perUnit props - 7/7 unit tests covering UAH, USD/EUR conversion, fallback, null, zero * feat(currency): lock all amount inputs to UAH (Variant B) + migrate CostRecords render via <Money/> - hardcode addonAfter='₴' on all amount/price InputNumber (13 files) - CostRecords table: column render + totals now use <Money/> (fixes the original '1000.00 USD' row vs '1 000,00 грн' total regression from PR #628) - i18n: add common.storedInUah ('Сума зберігається в гривнях' / 'Amount is stored in hryvnia') - Statistic displays keep dynamic suffix — they track user currency preference * test(currency): add Playwright E2E test for currency consistency + input lock * feat(currency): re-enable currency switcher after conversion layer v2 lands Reverts the PR #631 hotfix guards now that conversion math is implemented and unit-tested: - currencyStore.load() honors server's preferredCurrency (no force-UAH reset) - setPreferredCurrency(c) actually persists the chosen currency - ProfilePage: remove disabled attr and tooltip wrapper from the Select - users who previously had USD/EUR can opt back in * docs: update ROADMAP with PR #631 hotfix + conversion v2 status
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.
Why (urgent)
Regression discovered after PRs #613 and #628 shipped: the display hook changes the currency label but does not apply an exchange rate. On
/expenseswith user currency = USD the rows show1000.00 USDand the total shows1 000,00 грн, i.e. the same UAH value is rendered with inconsistent labels and no numeric conversion.Input forms also store values verbatim as UAH, so a user typing
1000while USD is selected would corrupt the record.What this hotfix does (no feature work — display only fix)
<Select/>isdisabledand wrapped in a<Tooltip/>"Валютна конвертація в розробці, буде доступна найближчим часом".currencyStore.load()— if the backend returns a non-UAH preference, we silently callupdatePreferences('UAH')to reset it server-side. This clears the mislabelling for users who had already switched to USD/EUR.currencyStore.setPreferredCurrency()is hard-forced to UAH regardless of argument, as a belt-and-braces guard.profile.currencyDisabledTooltip(UK + EN).What this hotfix does NOT do
<Money/>component, or input-side conversion — those are the follow-up PR.Verification
npx tsc --noEmit→ pass.Please squash-merge. Follow-up PR with real conversion,
<Money/>component, input lock to ₴, and Playwright tests is blocked on this.