Skip to content

fix: Dynamically load JS bundle (from update or assets) to prevent NPE#527

Merged
sunnylqm merged 1 commit intomasterfrom
fix-dynamic-jsbundle-loading
Mar 18, 2026
Merged

fix: Dynamically load JS bundle (from update or assets) to prevent NPE#527
sunnylqm merged 1 commit intomasterfrom
fix-dynamic-jsbundle-loading

Conversation

@sunnylqm
Copy link
Contributor

@sunnylqm sunnylqm commented Mar 18, 2026

Summary by CodeRabbit

  • Bug Fixes
    • Improved app restart process after updates with enhanced bundle loading logic that properly handles fallback scenarios when updated content is unavailable, ensuring more reliable recovery to app baseline.

@coderabbitai
Copy link

coderabbitai bot commented Mar 18, 2026

Caution

Review failed

Pull request was closed or merged during review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ec566aaa-1d70-4270-bcb8-5536655205bf

📥 Commits

Reviewing files that changed from the base of the PR and between 54c2c7a and d93934a.

📒 Files selected for processing (1)
  • android/src/main/java/cn/reactnative/modules/update/UpdateModuleImpl.java

📝 Walkthrough

Walkthrough

The restartApp method in UpdateModuleImpl.java now implements conditional bundle loader selection. If an update bundle path is available, it uses a file-based loader; otherwise, it falls back to an asset-based loader with a derived asset name.

Changes

Cohort / File(s) Summary
Bundle Loader Selection Logic
android/src/main/java/cn/reactnative/modules/update/UpdateModuleImpl.java
Modified restartApp to conditionally select between file-based and asset-based JSBundleLoaders based on update bundle path availability, with fallback to derived bundle asset name.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A bundle path check so wise,
File or asset, let logic decide,
Reload flows with branching pride,
Two paths forward, no surprise!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: implementing dynamic JS bundle loading from either update files or assets to prevent NPE, which matches the actual code modification.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-dynamic-jsbundle-loading
📝 Coding Plan
  • Generate coding plan for human review comments

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 and usage tips.

Tip

You can enable review details to help with troubleshooting, context usage and more.

Enable the reviews.review_details setting to include review details such as the model used, the time taken for each step and more in the review comments.

@sunnylqm sunnylqm merged commit 9f65d59 into master Mar 18, 2026
1 check was pending
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