Skip to content

fix(Android): Undefined-valued object pairs crash - #894

Merged
szydlovsky merged 3 commits into
mainfrom
@szydlovsky/android-undefined-style-values-crash
Dec 2, 2026
Merged

szydlovsky merged 3 commits into
mainfrom
@szydlovsky/android-undefined-style-values-crash

Conversation

@szydlovsky

Copy link
Copy Markdown
Collaborator

Summary

We have a crash (only on Android) related to passing undefined key values to native.

Basically, everywhere we pass more complex object to native, we use spread operator.
It makes a copy of the key:value pairs, so it brings undefined (if set) to native, without setting a default value there.
This results in crashes happening on Android only, because it has a strict props parser (iOS one is rather lenient).

The fix omits undefined-valued pairs, resulting in using default values again.

Test Plan

Set mentions' htmlStyle to

{ borderRadius: undefined }

and run the Android app. It should not crash anymore and make mentions attain default 0 border radius.

Screenshots / Videos

Before (recorded via Argent)

android-undefined-style-before.mp4

After (recorded via Argent)

android-undefined-style-after.mp4

Compatibility

OS Implemented
iOS ❌
Android ✅
Web ❌

Checklist

  • E2E tests are passing
  • Required E2E tests have been added (if applicable)

@szydlovsky
szydlovsky requested a review from exploIF December 1, 2026 16:36
@coderabbitai

coderabbitai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 3b87756 and 67b6cc5.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

Style normalization now omits undefined properties when merging styles. Added tests check that defaults remain in place for undefined values and that defined values are preserved.

Changes: Style normalization

Layer / File(s) Summary
Omit undefined values during style merging
src/utils/omitUndefined.ts, src/utils/expandMentionStylesForIndicators.ts, src/utils/normalizeHtmlStyle.ts, src/utils/__tests__/normalizeHtmlStyle.test.ts
Added omitUndefined and use it when merging mention styles and other style entries. Tests cover default fallback for undefined values and preservation of defined values.

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

Change: Bug fix

Suggested reviewers: pkaramon

Merge Risk: Minimal · previous review 7795c

The change omits undefined-valued style keys before they reach native code, so native defaults apply instead of crashing Android. Unit tests cover fallback and preservation. No concrete merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Description check Passed The description states the Android crash cause: undefined key values copied by the spread operator reach native code and fail its strict props parser. It gives a test plan using borderRadius set to un…
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.
Title check Passed The title says the fix addresses Android crashes caused by undefined-valued object pairs. The objectives and raw summary confirm the change omits undefined-valued keys from objects passed to native co…
Full details: Description check

Explanation

The description states the Android crash cause: undefined key values copied by the spread operator reach native code and fail its strict props parser. It gives a test plan using borderRadius set to undefined and shows the expected default 0 result. This matches the changeset, so it passes.

Full details: Title check

Explanation

The title says the fix addresses Android crashes caused by undefined-valued object pairs. The objectives and raw summary confirm the change omits undefined-valued keys from objects passed to native code, which prevents the Android strict props parser crash. The title names the main change and its platform. It is specific and matches the changeset. The title uses the term 'Undefined-valued object pairs', which is slightly less precise than 'object keys', but it still conveys the primary change.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • 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

Commits

Reviewing files that changed from the base of the PR and between db60605 and 7795c39.

Files selected for processing: 4

  • src/utils/__tests__/normalizeHtmlStyle.test.ts
  • src/utils/expandMentionStylesForIndicators.ts
  • src/utils/normalizeHtmlStyle.ts
  • src/utils/omitUndefined.ts

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

@szydlovsky szydlovsky changed the title fix(Android): Omit undefined-valued object keys passed to native fix(Android): Undefined-valued object pairs crash Dec 1, 2026
@szydlovsky
szydlovsky merged commit 22d4655 into main Dec 2, 2026
9 checks passed
@szydlovsky
szydlovsky deleted the @szydlovsky/android-undefined-style-values-crash branch December 2, 2026 13:32
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.

2 participants