Repository navigation
fix(app-shell): a dynamic currency change in record History reads in the tenant currency - #27779
Merged
Merged
Conversation
…the tenant currency The record page's History format context now carries `useLocalization().currency` as `tenantCurrency`, the value the page's currency cells read, so `resolveFieldCurrency` reaches the tenant default for a `dynamic`-mode field. `record`-mode fields stay a plain number. Claude-Session: https://claude.ai/code/session_01Utp6CY2n1JmZZKrHgtp9jC Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Utp6CY2n1JmZZKrHgtp9jC Co-authored-by: Claude <noreply@anthropic.com>
Contributor
Author
|
domain:ui#2 · os-bill · session_01Utp6CY2n1JmZZKrHgtp9jC 席位核对ACCEPT · head
Generated by Claude Code |
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.
domain:ui#2 · os-bill · session_01Utp6CY2n1JmZZKrHgtp9jC
Requested by Bill · project thread
Fixes #27640
Clause-②: no
Metadata-protocol: none
维护者速读
useLocalization().currency),dynamic币种字段的变更显示为€1,500.00 → €2,500.00,不再是裸数字。$4,321,000.00,History 里却是4,321,000.00,两处读数不一致;原因是 History 从没拿到租户币种。record模式不受影响;回滚即还原本 PR 一个提交。ui/packages/app-shell/src/views/RecordDetailView.tsx(fmtCtx一行、hook 读取、effect 依赖),再看新测试RecordDetailView.auditTenantCurrency-27640.test.tsx。pnpm --dir ui exec vitest run packages/app-shell/src/views/RecordDetailView.auditTenantCurrency-27640.test.tsx,预期 3 个测试全绿。What changes
RecordDetailView's History effect built its format context as{ t, locale: displayLocale, lookupLabels }, soformatAuditValue→resolveFieldCurrencynever reached its last step, the tenant default currency (AuditValueFormatContext.tenantCurrency, ADR-0053). Adynamic-mode currency change therefore read as a plain grouped number next to the record's own currency face.const { currency: tenantCurrency } = useLocalization();(from@object-ui/i18n), the same value the record page's cells read:DetailViewin@object-ui/plugin-detailtakes itstenantCurrencyfromuseLocalization()the same way. The view held no such value before, so this is the one hook read the triage allowed.fmtCtxbecomes{ t, locale: displayLocale, lookupLabels, tenantCurrency }.tenantCurrencyjoins the History effect's dependency list besidedisplayLocale, so the stream re-formats when the tenant's localization arrives or changes, the way it already does for a display-locale switch.record-mode fields are unchanged (out of scope per triage):resolveFieldCurrencyanswers no code for them without the row, and the tenant default is never their fallback.Changeset:
.changeset/27640-history-dynamic-currency.md,@object-ui/app-shellpatch.Tests
New:
ui/packages/app-shell/src/views/RecordDetailView.auditTenantCurrency-27640.test.tsxrenders the record page on its History stream (?tab=timeline) under a realI18nProviderand aLocalizationProvider, with one audit entry that moves adynamicfield and arecord-mode field from 1500 to 2500:dynamicchange readsAmount €1,500.00 → €2,500.00(the pin);record-mode change staysList price 1,500.00 → 2,500.00;dynamicchange readsAmount 1,500.00 → 2,500.00.Ablation (fix committed first, mutation through
scripts/ablation-replace.mjs): replacinglookupLabels, tenantCurrency };withlookupLabels };landed on disk (anchor 1 → 0, blobab5f20a6e2c8→cb4dc3752561); the pin went red (got: Amount 1,500.00 → 2,500.00), the record-mode case and the control stayed green, and the restore matched the HEAD blobab5f20a6e2c8.Acceptance notes
RecordDetailView.tsx; its patch does not touch the hunks here (the import line, thedisplayLocalehook area,fmtCtxand the History effect's dependency list). Whichever lands second rebases.@object-ui/app-shellpackage holds about 1,900 test files, too many to run on the shared box under the verification lock, so the local run covers every test file that importsRecordDetailViewplus theauditHistoryDisplayunit tests.Test UIin CI runs the whole package.Verification
Local readings, on head
7be9046e(after the one merge oforigin/main) unless named otherwise.Targeted tests
Test Files 1 passed (1),Tests 3 passed (3).RecordDetailView.auditDisplayLocale-10442,auditHistoryDisplay.numericAmounts-27486): green.RecordDetailViewplus theauditHistoryDisplayunit tests (157 files, the new one included):Test Files 156 passed | 1 skipped (157),Tests 1079 passed | 8 skipped (1087), lockVERDICT command-exit 0.Typecheck and lint
pnpm --filter @object-ui/app-shell run type-check(bothtsc --noEmitandtsconfig.test.json), onf804616f(the merge brought no change to this diff's files): lockVERDICT command-exit 0.eslinton the two touched source files: exit 0, 0 errors (warnings only, the existingno-explicit-anyones and twoas anytest doubles that mirror the sibling History test).pnpm check:new-line-citations(run by hand perui/AGENTS.md): 0 new citations.Derived gates
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackderived 34 commands over the 3 changed paths; all 34 exited 0 (node scripts/check-sdui-manifest.mjsamong them), and--ranreconciled 34 derived / 34 run / 0 NOT-MEASURED. Re-run in full on7be9046e: 34/34 exit 0,--ranreconciled 34/34/0.Generated by Claude Code