Skip to content

fix: handle undefined bytes.buffer in createCursor for React Native#4164

Merged
jxom merged 3 commits intomainfrom
fix/cursor-buffer-react-native
Dec 15, 2025
Merged

fix: handle undefined bytes.buffer in createCursor for React Native#4164
jxom merged 3 commits intomainfrom
fix/cursor-buffer-react-native

Conversation

@jxom
Copy link
Copy Markdown
Member

@jxom jxom commented Dec 15, 2025

Summary

Fixes #4002

In React Native with the buffer polyfill, Uint8Array.buffer can be undefined, causing a TypeError: Cannot read property 'buffer' of undefined when createCursor attempts to create a DataView.

Added a nullish coalescing fallback (bytes.buffer ?? bytes) so that if bytes.buffer is undefined, it falls back to using bytes directly as the ArrayBuffer-like source for the DataView.

Fixes #4002

In React Native with the buffer polyfill, Uint8Array.buffer can be undefined.
Added nullish coalescing fallback to use bytes directly if buffer is undefined.
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Dec 15, 2025

🦋 Changeset detected

Latest commit: f3f295a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
viem Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@jxom jxom merged commit 85b4f81 into main Dec 15, 2025
31 of 32 checks passed
@jxom jxom deleted the fix/cursor-buffer-react-native branch December 15, 2025 04:10
@github-actions github-actions bot mentioned this pull request Dec 15, 2025
@codecov
Copy link
Copy Markdown

codecov bot commented Dec 15, 2025

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 94.20%. Comparing base (f0e1a5c) to head (f3f295a).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
src/utils/cursor.ts 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4164      +/-   ##
==========================================
- Coverage   94.23%   94.20%   -0.03%     
==========================================
  Files        1088     1088              
  Lines        8010     8011       +1     
  Branches     2567     2568       +1     
==========================================
- Hits         7548     7547       -1     
  Misses        166      166              
- Partials      296      298       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

Accessing bytes.buffer from createCursor() results in undefined error within react-native

1 participant