Skip to content

Conversation

@upupming
Copy link
Collaborator

@upupming upupming commented Oct 21, 2025

The Page component has a singleton pageMounted variable. It should be shared between the main and lazy bundles to make it work properly in lazy bundle.

Summary by CodeRabbit

  • Bug Fixes
    • Fixed runtime-components exports to be accessible from both main and lazy bundles, ensuring consistent API availability across bundle types.

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).
  • Changeset added, and when a BREAKING CHANGE occurs, it needs to be clearly marked (or not required).

@upupming upupming requested a review from hzy as a code owner October 21, 2025 16:12
@changeset-bot
Copy link

changeset-bot bot commented Oct 21, 2025

🦋 Changeset detected

Latest commit: 5023aa5

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

This PR includes changesets to release 1 package
Name Type
@lynx-js/react 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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 21, 2025

📝 Walkthrough

Walkthrough

This PR adds lazy bundle support for @lynx-js/react/runtime-components exports. It introduces a new lazy entry point that re-exports Page and DeferredListItem through a dynamic symbol-based mapping, updates the package.json exports map, and includes corresponding test coverage.

Changes

Cohort / File(s) Summary
Configuration & Release
.changeset/cute-frogs-refuse.md, packages/react/package.json
Adds changeset entry for patch release documenting runtime-components export sharing; updates package.json to include lazy export for ./runtime-components pointing to lazy bundle entry point.
Lazy Loading Infrastructure
packages/react/runtime/lazy/target.js, packages/react/runtime/lazy/import.js
Introduces new Symbol constant sExportsReactRuntimeComponents for identifying runtime-components exports; imports ReactRuntimeComponents and exposes it via Object.defineProperty in the lazy import module.
Lazy Runtime Components Entry Point
packages/react/runtime/lazy/runtime-components.js
New file that re-exports Page and DeferredListItem from the dynamic symbol-based target mapping for lazy bundle consumption.
Test Coverage
packages/react/runtime/__test__/lazy.test.js
Updates test to validate runtime-components exports from lazy bundle, replacing previous jsx-runtime test; imports and validates Page and DeferredListItem against expected public API surface.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

The changes follow a consistent, homogeneous pattern across files—adding a new lazy export path through the existing symbol-based mapping system. While understanding the lazy loading architecture is helpful, individual changes are straightforward and repetitive in nature.

Suggested labels

framework:React

Suggested reviewers

  • hzy
  • colinaaa
  • Yradex

Poem

🐰 Through lazy symbols we hop and weave,
Runtime components now interleave,
Bundles share their treasured Page and List,
No duplication shall be missed! 🌟

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The PR title "feat: share runtime-components exports between the main and lazy bundles" directly and accurately reflects the primary objective of the changeset. The changes across all files—adding a lazy export in package.json, updating the test, importing runtime-components in import.js, creating runtime-components.js, and adding the corresponding Symbol in target.js—all work together to accomplish exactly what the title describes. The title is specific, clear, and concise, using concrete terminology that would help teammates understand the purpose when scanning commit history.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

@upupming upupming changed the title feat: share @lynx-js/react/runtime-components exports between the m… feat: share runtime-components exports between the main and lazy bundles Oct 21, 2025
@codecov
Copy link

codecov bot commented Oct 21, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@relativeci
Copy link

relativeci bot commented Oct 21, 2025

React Example

#5954 Bundle Size — 237.5KiB (0%).

5023aa5(current) vs 353312e main#5953(baseline)

Bundle metrics  no changes
                 Current
#5954
     Baseline
#5953
No change  Initial JS 0B 0B
No change  Initial CSS 0B 0B
No change  Cache Invalidation 0% 0%
No change  Chunks 0 0
No change  Assets 4 4
No change  Modules 165 165
No change  Duplicate Modules 67 67
No change  Duplicate Code 46.77% 46.77%
No change  Packages 2 2
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#5954
     Baseline
#5953
No change  IMG 145.76KiB 145.76KiB
No change  Other 91.74KiB 91.74KiB

Bundle analysis reportBranch upupming:feat/disable-page-in-la...Project dashboard


Generated by RelativeCIDocumentationReport issue

@relativeci
Copy link

relativeci bot commented Oct 21, 2025

Web Explorer

#5950 Bundle Size — 364.68KiB (0%).

5023aa5(current) vs 353312e main#5949(baseline)

Bundle metrics  Change 1 change
                 Current
#5950
     Baseline
#5949
No change  Initial JS 144.63KiB 144.63KiB
No change  Initial CSS 32.11KiB 32.11KiB
No change  Cache Invalidation 0% 0%
No change  Chunks 8 8
No change  Assets 8 8
Change  Modules 220(+0.46%) 219
No change  Duplicate Modules 16 16
No change  Duplicate Code 3.23% 3.23%
No change  Packages 4 4
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#5950
     Baseline
#5949
No change  JS 238.77KiB 238.77KiB
No change  Other 93.8KiB 93.8KiB
No change  CSS 32.11KiB 32.11KiB

Bundle analysis reportBranch upupming:feat/disable-page-in-la...Project dashboard


Generated by RelativeCIDocumentationReport issue

@codspeed-hq
Copy link

codspeed-hq bot commented Oct 21, 2025

CodSpeed Performance Report

Merging #1895 will improve performances by 6.32%

Comparing upupming:feat/disable-page-in-lazy (5023aa5) with main (353312e)

Summary

⚡ 1 improvement
✅ 52 untouched
⏩ 3 skipped1

Benchmarks breakdown

Benchmark BASE HEAD Change
transform 1000 view elements 44.9 ms 42.2 ms +6.32%

Footnotes

  1. 3 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@upupming upupming marked this pull request as draft October 24, 2025 02:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant