Skip to content

修复兑换码新增和修改页面的额度输入框清空问题 - #6703

Closed
lihu-001 wants to merge 3 commits into
QuantumNous:mainfrom
lihu-001:fix/duihuanm_del1
Closed

修复兑换码新增和修改页面的额度输入框清空问题#6703
lihu-001 wants to merge 3 commits into
QuantumNous:mainfrom
lihu-001:fix/duihuanm_del1

Conversation

@lihu-001

@lihu-001 lihu-001 commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

⚠️ 提交说明 / PR Notice

Important

  • 修复兑换码新增和修改页面的额度输入框清空问题

📝 变更描述 / Description

  • 调整 web/src/features/redemption-codes/components/redemptions-mutate-drawer.tsx:300
  • 输入框为空时保留空字符串,不再通过 || 0 强制转换为 0
  • 非空输入仍正常转换为数字
  • 新增回归测试,覆盖:
    • 新增兑换码时清空额度
    • 修改兑换码时清空额度

🚀 变更类型 / Type of change

🔗 关联任务 / Related Issue

✅ 提交前检查项 / Checklist

  • 人工确认: 我已亲自整理并撰写此描述,没有直接粘贴未经处理的 AI 输出。
  • 非重复提交: 我已搜索现有的 IssuesPRs,确认不是重复提交。
  • Bug fix 说明: 若此 PR 标记为 Bug fix,我已提交或关联对应 Issue,且不会将设计取舍、预期不一致或理解偏差直接归类为 bug。
  • 变更理解: 我已理解这些更改的工作原理及可能影响。
  • 范围聚焦: 本 PR 未包含任何与当前任务无关的代码改动。
  • 本地验证: 已在本地运行并通过测试或手动验证,维护者可以据此复核结果。
  • 安全合规: 代码中无敏感凭据,且符合项目代码规范。

📸 运行证明 / Proof of Work

image

Summary by CodeRabbit

  • Bug Fixes
    • Quota fields now preserve an empty value instead of automatically changing it to zero.
    • Non-empty quota values continue to support decimal numbers.

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 7724084f-7b1e-4ab1-9d56-ad1ffcea90cb

📥 Commits

Reviewing files that changed from the base of the PR and between e0f4d38 and 49a5b45.

📒 Files selected for processing (1)
  • web/src/features/usage-logs/components/__tests__/cost-display.test.tsx

Walkthrough

The redemption quota input now remains empty when users delete all content. Non-empty input remains parsed as a floating-point number. The drawer mutation test file was deleted. The cost display test now uses Bun’s test APIs and cleanup hook.

Changes

Redemption quota input

Layer / File(s) Summary
Preserve empty quota values
web/src/features/redemption-codes/components/redemptions-mutate-drawer.tsx, web/src/features/redemption-codes/components/__tests__/redemptions-mutate-drawer.test.tsx
Blank quota input now remains an empty string. Non-empty input continues to use floating-point parsing. The drawer test file was removed.

Usage-log test setup

Layer / File(s) Summary
Use Bun test hooks
web/src/features/usage-logs/components/__tests__/cost-display.test.tsx
The test dynamically imports bun:test, keeps Node-compatible test types, and uses afterAll for cleanup.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related issues

Possibly related PRs

Poem

A rabbit taps Backspace, light and slow,
The last small number fades to glow.
No forced zero springs in sight,
Empty fields now feel just right.
Bun tests clean up at night.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The code fix meets Issue #6681, but the requested regression coverage was deleted instead of added. Restore or add regression tests for clearing quota values on redemption-code create and edit pages.
Out of Scope Changes check ⚠️ Warning The usage-logs test-runner changes are unrelated to Issue #6681 and fall outside the pull request objective. Move the usage-logs test-runner changes to a separate pull request.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes fixing the quota input clearing problem on redemption-code create and edit pages.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@lihu-001 lihu-001 closed this Aug 10, 2026
@coderabbitai coderabbitai Bot mentioned this pull request Aug 10, 2026
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

兑换码的新值与修改页面的额度输入框,有值时,点击键盘的backspace键,删除到最后会强制显示为0

2 participants