Conversation
|
No actionable comments were generated in the recent review. 🎉 WalkthroughUpdated CHANGELOG.md with a new 0.24.1 entry describing a fix that prevents very large double values (e.g., 1.7976931348623157e+308) from being expanded into giant integer literals. package.json version was bumped from 0.24.0 to 0.24.1. src/client.ts added 64-bit integer bounds (MAX_INT64, MIN_INT64) and adjusted the JSON reviver: preserve Numbers within the safe JS range, convert integer BigNumber values within 64-bit range to BigInt, and fall back to Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/client.ts (1)
24-36: Consider string-length pre-check to skip unnecessaryBigIntallocation for values clearly outside INT64 range.For floats like
1.7976931348623157e+308,isInteger()returnstruein bignumber.js (no fractional part at that scale), sotoFixed()produces a ~309-character string andBigInt(str)allocates a large BigInt — only to immediately discard it at line 34. A length guard short-circuits the allocation before the out-of-range branch:⚡ Proposed optimization: pre-check string length before BigInt allocation
function reviver(_key: string, value: any): any { if (isBigNumber(value)) { if (value.isInteger()) { const str = value.toFixed(); + // MAX_INT64 is 19 digits; MIN_INT64 is 20 chars (with leading '-') + const isNeg = str.length > 0 && str[0] === '-'; + if ((!isNeg && str.length > 19) || (isNeg && str.length > 20)) { + return value.toNumber(); + } const bi = BigInt(str); if (bi >= MIN_SAFE && bi <= MAX_SAFE) { return Number(str); } if (bi >= MIN_INT64 && bi <= MAX_INT64) { return bi; } return value.toNumber(); } return value.toNumber(); } return value; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/client.ts` around lines 24 - 36, The current code calls BigInt(str) after value.toFixed(), which can allocate huge BigInts for extreme magnitudes; add a cheap string-length guard before creating a BigInt: after computing const str = value.toFixed(); check the trimmed numeric length (e.g. const digits = str.startsWith('-') ? str.length - 1 : str.length) and if digits exceeds the max decimal digits for INT64 (19) immediately skip BigInt allocation and return value.toNumber() (or the appropriate fallback) instead of executing BigInt(str); update the branch around isBigNumber/value.isInteger() that uses MIN_INT64/MAX_INT64 and BigInt(str) to use this length check to short-circuit.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/client.ts`:
- Around line 24-36: The current code calls BigInt(str) after value.toFixed(),
which can allocate huge BigInts for extreme magnitudes; add a cheap
string-length guard before creating a BigInt: after computing const str =
value.toFixed(); check the trimmed numeric length (e.g. const digits =
str.startsWith('-') ? str.length - 1 : str.length) and if digits exceeds the max
decimal digits for INT64 (19) immediately skip BigInt allocation and return
value.toNumber() (or the appropriate fallback) instead of executing BigInt(str);
update the branch around isBigNumber/value.isInteger() that uses
MIN_INT64/MAX_INT64 and BigInt(str) to use this length check to short-circuit.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@CHANGELOG.md`:
- Around line 3-5: Update the changelog header that currently reads "## 0.24.1"
to match the actual package release version ("0.23.2") so the entry aligns with
package.json and SDK headers; locate the header string "## 0.24.1" in
CHANGELOG.md and replace it with "## 0.23.2" to correct ordering and version
consistency.
| ## 0.24.1 | ||
|
|
||
| * Fix very large double values (for example 1.7976931348623157e+308) from being expanded into giant integer literals. |
There was a problem hiding this comment.
Changelog version header doesn't match the release version.
The entry is labelled ## 0.24.1, but every other artefact in this PR (package.json, src/client.ts SDK header) targets version 0.23.2. With an existing ## 0.24.0 entry already in the file, this also creates a confusing ordering where two 0.24.x entries sit above a 0.23.1 entry while the actual package version is 0.23.2.
The heading should be changed to match the actual release:
📝 Proposed fix
-## 0.24.1
+## 0.23.2📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| ## 0.24.1 | |
| * Fix very large double values (for example 1.7976931348623157e+308) from being expanded into giant integer literals. | |
| ## 0.23.2 | |
| * Fix very large double values (for example 1.7976931348623157e+308) from being expanded into giant integer literals. |
🧰 Tools
🪛 LanguageTool
[style] ~5-~5: As an alternative to the over-used intensifier ‘very’, consider replacing this phrase.
Context: # Change log ## 0.24.1 * Fix very large double values (for example 1.7976931348...
(EN_WEAK_ADJECTIVE)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@CHANGELOG.md` around lines 3 - 5, Update the changelog header that currently
reads "## 0.24.1" to match the actual package release version ("0.23.2") so the
entry aligns with package.json and SDK headers; locate the header string "##
0.24.1" in CHANGELOG.md and replace it with "## 0.23.2" to correct ordering and
version consistency.
src/client.ts
Outdated
| 'x-sdk-version': '0.24.0', | ||
| 'x-sdk-version': '0.23.2', |
This PR contains updates to the React Native SDK for version 0.24.1.
Summary by CodeRabbit
Bug Fixes
Chores