From 394b023dbf9896dee762dd8b9249ce0d22f07146 Mon Sep 17 00:00:00 2001 From: feitianbubu Date: Tue, 7 Jul 2026 21:12:54 +0800 Subject: [PATCH] fix: keep group ratio input as string draft to allow decimal typing (#5995) The ratio column normalized input to number on every keystroke, so typing 0.05 got stuck at 0.0 which Number() collapses to 0. Keep the value as a string draft like the top-up ratio column and only convert to number when serializing. Fixes #5986 --- .../models/group-ratio-visual-editor.tsx | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/web/default/src/features/system-settings/models/group-ratio-visual-editor.tsx b/web/default/src/features/system-settings/models/group-ratio-visual-editor.tsx index f309e5e8..c179c7bf 100644 --- a/web/default/src/features/system-settings/models/group-ratio-visual-editor.tsx +++ b/web/default/src/features/system-settings/models/group-ratio-visual-editor.tsx @@ -83,7 +83,7 @@ type GroupRatioVisualEditorProps = { type GroupPricingRow = { _id: string name: string - ratio: number + ratio: string topupRatio: string selectable: boolean description: string @@ -149,7 +149,7 @@ function buildGroupPricingRows( return [...names].map((name) => ({ _id: createGroupPricingId(), name, - ratio: normalizeRatio(ratioMap[name]), + ratio: String(normalizeRatio(ratioMap[name])), topupRatio: Object.hasOwn(topupMap, name) ? String(topupMap[name]) : '', selectable: Object.hasOwn(usableMap, name), description: String(usableMap[name] ?? ''), @@ -491,7 +491,7 @@ function GroupPricingTable({ { _id: createGroupPricingId(), name, - ratio: 1, + ratio: '1', topupRatio: '', selectable: true, description: '', @@ -567,13 +567,9 @@ function GroupPricingTable({ type='number' min={0} step={0.1} - value={String(row.ratio)} + value={row.ratio} onChange={(event) => - updateRow( - row._id, - 'ratio', - normalizeRatio(event.target.value) - ) + updateRow(row._id, 'ratio', event.target.value) } /> ),