Uh oh!
There was an error while loading. Please reload this page.
feat(currency): client tenant-default currency context + shared field resolver - #1856
Merged
Conversation
… resolver Phase 2b foundation for unifying currency rendering. The cross-repo audit found the client had NO access to a tenant/org default currency, and ~20 renderers each resolved currency differently (some read only `field.currency`, others `defaultCurrency`, others `currencyConfig`; 3 different Intl locales; hardcoded `$`/`¥`/`USD` fallbacks). Server-side resolution landed in framework #2119/#2121 and is exposed at `/auth/me/localization` (#2122) — this wires the client half. - `@object-ui/i18n`: a pure `LocalizationProvider` + `useLocalization()` exposing the tenant `{ currency, locale }`. Low-level so any field/measure renderer can read it without depending on app-shell or fetching itself. Safe outside a provider (returns `{}` → plain number). - `@object-ui/fields`: `resolveFieldCurrency(field, tenantDefault?)` — the single precedence (field `currency` → `currencyConfig.defaultCurrency` → legacy `defaultCurrency` → tenant default → undefined), ending the per-renderer drift. - `CurrencyCellRenderer` migrated onto it (first consumer): a currency field with no own currency now shows the org default instead of a bare number. - Console: `LocalizationFetchProvider` loads `/auth/me/localization` once and feeds the context (cosmetic / never blocks the app). Staged follow-up (migration PR): the long tail — CurrencyField, DetailView, useColumnSummary (+ its stale "defaults to USD" comment), MetricWidget, ObjectDataTable, PivotTable, ObjectGantt, ObjectGrid, elements:number, FieldFactory — plus collapsing the two divergent `formatCurrency` into one. Tests: LocalizationContext 2, resolveFieldCurrency 4; fields 4094 + i18n 152 unchanged. type-check green across console/fields/i18n. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
✅ Console Performance Budget
📦 Bundle Size Report
Size Limits
|
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Jun 21, 2026
xuyushun441-sys added a commit
that referenced
this pull request
Jun 21, 2026
…rers (#1858) Phase 2b of the currency-resolution work (ADR-0053). The field/cell renderers already funnelled through resolveFieldCurrency + useLocalization (#1856); this unifies the remaining renderers onto the same chain (explicit field currency -> currencyConfig.defaultCurrency -> legacy defaultCurrency -> tenant localization.currency -> plain number): - plugin-dashboard: ObjectMetricWidget inferred currency, ObjectDataTable symbol-format fallback. - plugin-grid: useColumnSummary footer + ObjectGrid compact/name-inferred cells. - plugin-detail: DetailView summary metrics. - plugin-gantt: ObjectGantt currency tooltips. - components: element:number (format:'currency') — tenant default + tenant locale instead of a baked-in USD. resolveFieldCurrency moves to @object-ui/i18n (co-located with useLocalization, which supplies the tenant default); @object-ui/fields re-exports it so the existing import path is unchanged. No behavior change when no tenant currency is configured. Adds i18n unit + plugin-grid hook + dashboard table integration tests. Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
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 freeto 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.
Phase 2b foundation — unify client currency rendering
The cross-repo currency audit found the client had no access to a tenant/org default currency, and ~20 renderers each resolved currency differently (some read only
field.currency, othersdefaultCurrency, otherscurrencyConfig; 3 different Intl locales; hardcoded$/¥/USDfallbacks). Server-side resolution landed in framework #2119/#2121 and is exposed at/auth/me/localization(#2122) — this PR wires the client half.Changes
@object-ui/i18n: pureLocalizationProvider+useLocalization()→ tenant{ currency, locale }. Low-level so any field/measure renderer can read it without depending on app-shell or fetching itself. Safe outside a provider (returns{}→ plain number).@object-ui/fields:resolveFieldCurrency(field, tenantDefault?)— the single precedence (fieldcurrency→currencyConfig.defaultCurrency→ legacydefaultCurrency→ tenant default →undefined), ending the per-renderer drift.CurrencyCellRenderermigrated onto it (first consumer): a currency field with no own currency now shows the org default instead of a bare number.LocalizationFetchProviderloads/auth/me/localizationonce and feeds the context — cosmetic, never blocks the app.Staged follow-up (migration PR)
The long tail, now a trivial swap onto
resolveFieldCurrency+useLocalization:CurrencyField,DetailView,useColumnSummary(+ its stale "defaults to USD" comment),MetricWidget,ObjectDataTable,PivotTable,ObjectGantt,ObjectGrid,elements:number,FieldFactory— plus collapsing the two divergentformatCurrencyinto one with a single locale.Tests
LocalizationContext(2: in/out of provider),resolveFieldCurrency(4: full precedence).fields4094 passed,i18n152 passed — migration preserves existing behavior (no provider → identical output).type-checkgreen across console / fields / i18n.🤖 Generated with Claude Code