Skip to content

fix(components): preserve exponent values in the row editor - #2956

Open
peterolkhov wants to merge 1 commit into
instantdb:mainfrom
peterolkhov:codex/fix-row-number-exponents
Open

peterolkhov wants to merge 1 commit into
instantdb:mainfrom
peterolkhov:codex/fix-row-number-exponents

Conversation

@peterolkhov

Copy link
Copy Markdown

The Explorer number input accepts scientific notation, but entering 1e6 currently changes it to 16 before Save builds the transaction. The shared number parser removes the exponent marker as though it were formatting.

Parse complete finite numbers before the existing formatted-number fallback. This also preserves values that JavaScript serializes with an exponent. Empty/null handling and conversions such as $1,234.50 stay intact.

Adds 15 parser tests and connects them to test:ci through the existing Vitest dependency. No new dependency or public barrel export.

Validation:

  • Native behavior/build run: 8 new regressions fail on the old parser; all26 existing/new component tests pass after the fix. Component types/build, six unchanged browser cases and seven Add/Edit/type-conversion/null/required checks pass. Browser tests exercise actual UI and SDK transaction construction, with the write boundary captured; no stored database write was made.
  • Clean source formatting comparison: changed files and all tracked component files pass. The official whole-client check-format exits1 on the same17 sandbox files in both original and candidate. Its full output is identical after normalizing checkout paths; those existing warnings are not fixed here. Neither workflow is claimed entirely green.

Codex generated the implementation, tests and this description; a separate Sol-high pass reviewed the patch and the native results were checked before submission.

@coderabbitai

coderabbitai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The change exports parseFieldValue and adds an initial finite-number conversion for number fields. Tests cover numeric inputs, currency-formatted strings, empty strings, and null. The components package adds a test:ci script that runs Vitest.

Changes: Number field parsing

Layer / File(s) Summary
Number field parsing and validation
client/packages/components/src/components/explorer/edit-row-dialog.tsx, client/packages/components/src/components/explorer/__tests__/edit-row-dialog.test.ts, client/packages/components/package.json
parseFieldValue now returns finite numeric conversions for nonempty number-field inputs before using its existing fallback. Tests cover numeric inputs, currency-formatted strings, empty strings, and null. The package adds a test:ci script that runs Vitest.

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

Change: Bug fix

Suggested reviewers: drew-harris, nezaj

Merge Risk: Minimal · up to be3dc

Exponent values such as 1e6 are now preserved when editing number fields, and formatted values still parse. No merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the row editor's number parsing now keeps exponent values such as 1e6 instead of altering them. It uses the fix() conventional-commit prefix and a specific scope. It m…
Description check Passed The description states the bug: entering 1e6 in the Explorer number input becomes 16 because the shared number parser strips the exponent marker. It explains the fix, which parses complete finite numb…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: the row editor's number parsing now keeps exponent values such as 1e6 instead of altering them. It uses the fix() conventional-commit prefix and a specific scope. It matches the parseFieldValue change and the parser tests in the changeset, and it matches the PR objectives.

Full details: Description check

Explanation

The description states the bug: entering 1e6 in the Explorer number input becomes 16 because the shared number parser strips the exponent marker. It explains the fix, which parses complete finite numbers before the formatted-number fallback. It also lists the 15 added parser tests, the test:ci wiring, and the validation runs. This matches the edit-row-dialog.tsx and test file changes in the raw summary.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e50394e1-a791-48f3-a4f4-dff659187491
Commits

Reviewing files that changed from the base of the PR and between 15358ad and be3dc34.

Files selected for processing: 3

  • client/packages/components/package.json
  • client/packages/components/src/components/explorer/__tests__/edit-row-dialog.test.ts
  • client/packages/components/src/components/explorer/edit-row-dialog.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

This branch has not been deployed

No deployments
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.

1 participant