Skip to content

refactor(runtime): export vnode constants from internal#2415

Merged
HuJean merged 1 commit intomainfrom
chore/runtime-vnode-constants
Apr 3, 2026
Merged

refactor(runtime): export vnode constants from internal#2415
HuJean merged 1 commit intomainfrom
chore/runtime-vnode-constants

Conversation

@HuJean
Copy link
Copy Markdown
Collaborator

@HuJean HuJean commented Apr 3, 2026

Summary by CodeRabbit

  • Refactor
    • Updated internal React runtime data structures for improved encapsulation and maintainability.
    • Optimized internal property handling within the React rendering system.

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).

@HuJean HuJean requested review from Yradex and hzy as code owners April 3, 2026 03:52
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 3, 2026

🦋 Changeset detected

Latest commit: 0259d2c

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

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

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
Copy Markdown
Contributor

coderabbitai bot commented Apr 3, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d148cbf7-be32-4d4b-81f6-61323dc8bf4f

📥 Commits

Reviewing files that changed from the base of the PR and between 44b966c and 0259d2c.

📒 Files selected for processing (5)
  • .changeset/tall-taxis-laugh.md
  • packages/react/runtime/lazy/internal.js
  • packages/react/runtime/lepus/jsx-runtime/index.js
  • packages/react/runtime/src/internal.ts
  • packages/react/runtime/src/renderToOpcodes/constants.ts

📝 Walkthrough

Walkthrough

The pull request introduces symbol-keyed properties for VNode internal fields across the React runtime. Constants INDEX and FLAGS are added, symbol identifiers are exported through multiple modules, and fixed property names in the JSX runtime are replaced with computed symbol-keyed properties while preserving initialization semantics.

Changes

Cohort / File(s) Summary
Changeset
.changeset/tall-taxis-laugh.md
Empty frontmatter changeset file added.
Symbol Constants Definition
packages/react/runtime/src/renderToOpcodes/constants.ts
Added two new property constants: INDEX = '__i' and FLAGS = '__u'.
Symbol Exports and Re-exports
packages/react/runtime/lazy/internal.js, packages/react/runtime/src/internal.ts
Added exports and re-exports of symbol identifiers (CHILDREN, COMPONENT, DIFF, DIRTY, DOM, FLAGS, INDEX, PARENT) from internal module surfaces.
VNode Field Refactoring
packages/react/runtime/lepus/jsx-runtime/index.js
Renamed fixed property names (__k, __, __b, __e, __d, __c, __i, __u) to symbol-keyed properties ([CHILDREN], [PARENT], [DIFF], [DOM], [DIRTY], [COMPONENT], [INDEX], [FLAGS]) with preserved initialization semantics.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Suggested labels

framework:React

Suggested reviewers

  • Yradex
  • hzy

Poem

🐰 With symbols bold we hop along,
Old property names now changed to song—
__k and friends in new attire,
Symbol-keyed, the fields now fire!
A refactor swift, with constants true. ✨

🚥 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: exporting vnode constants from the internal module, which is reflected across multiple files in the changeset.

✏️ 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 chore/runtime-vnode-constants

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.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 3, 2026

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!

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Apr 3, 2026

Merging this PR will degrade performance by 14.83%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 1 improved benchmark
❌ 1 regressed benchmark
✅ 70 untouched benchmarks
⏩ 21 skipped benchmarks1

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
002-hello-reactLynx-destroyBackground 930.3 µs 679.3 µs +36.95%
transform 1000 view elements 40.3 ms 47.3 ms -14.83%

Comparing chore/runtime-vnode-constants (0259d2c) with main (44b966c)

Open in CodSpeed

Footnotes

  1. 21 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.

@relativeci
Copy link
Copy Markdown

relativeci bot commented Apr 3, 2026

React MTF Example

#184 Bundle Size — 207.38KiB (0%).

0259d2c(current) vs 44b966c main#178(baseline)

Bundle metrics  Change 1 change
                 Current
#184
     Baseline
#178
No change  Initial JS 0B 0B
No change  Initial CSS 0B 0B
Change  Cache Invalidation 0% 46.36%
No change  Chunks 0 0
No change  Assets 3 3
No change  Modules 174 174
No change  Duplicate Modules 68 68
Change  Duplicate Code 46.08%(-0.02%) 46.09%
No change  Packages 2 2
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#184
     Baseline
#178
No change  IMG 111.23KiB 111.23KiB
No change  Other 96.15KiB 96.15KiB

Bundle analysis reportBranch chore/runtime-vnode-constantsProject dashboard


Generated by RelativeCIDocumentationReport issue

@relativeci
Copy link
Copy Markdown

relativeci bot commented Apr 3, 2026

React Example

#7052 Bundle Size — 237.81KiB (0%).

0259d2c(current) vs 44b966c main#7046(baseline)

Bundle metrics  Change 1 change
                 Current
#7052
     Baseline
#7046
No change  Initial JS 0B 0B
No change  Initial CSS 0B 0B
Change  Cache Invalidation 0% 38.7%
No change  Chunks 0 0
No change  Assets 4 4
No change  Modules 180 180
No change  Duplicate Modules 71 71
Change  Duplicate Code 46.39%(-0.02%) 46.4%
No change  Packages 2 2
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#7052
     Baseline
#7046
No change  IMG 145.76KiB 145.76KiB
No change  Other 92.05KiB 92.05KiB

Bundle analysis reportBranch chore/runtime-vnode-constantsProject dashboard


Generated by RelativeCIDocumentationReport issue

@relativeci
Copy link
Copy Markdown

relativeci bot commented Apr 3, 2026

React External

#170 Bundle Size — 591.44KiB (+0.08%).

0259d2c(current) vs 44b966c main#164(baseline)

Bundle metrics  no changes
                 Current
#170
     Baseline
#164
No change  Initial JS 0B 0B
No change  Initial CSS 0B 0B
No change  Cache Invalidation 30.97% 30.97%
No change  Chunks 0 0
No change  Assets 3 3
No change  Modules 17 17
No change  Duplicate Modules 5 5
No change  Duplicate Code 8.59% 8.59%
No change  Packages 0 0
No change  Duplicate Packages 0 0
Bundle size by type  Change 1 change Regression 1 regression
                 Current
#170
     Baseline
#164
Regression  Other 591.44KiB (+0.08%) 590.96KiB

Bundle analysis reportBranch chore/runtime-vnode-constantsProject dashboard


Generated by RelativeCIDocumentationReport issue

@relativeci
Copy link
Copy Markdown

relativeci bot commented Apr 3, 2026

Web Explorer

#8627 Bundle Size — 728.84KiB (0%).

0259d2c(current) vs 44b966c main#8621(baseline)

Bundle metrics  no changes
                 Current
#8627
     Baseline
#8621
No change  Initial JS 43.31KiB 43.31KiB
No change  Initial CSS 2.16KiB 2.16KiB
No change  Cache Invalidation 0% 0%
No change  Chunks 8 8
No change  Assets 10 10
No change  Modules 150 150
No change  Duplicate Modules 11 11
No change  Duplicate Code 34.68% 34.68%
No change  Packages 3 3
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#8627
     Baseline
#8621
No change  Other 384.62KiB 384.62KiB
No change  JS 342.07KiB 342.07KiB
No change  CSS 2.16KiB 2.16KiB

Bundle analysis reportBranch chore/runtime-vnode-constantsProject dashboard


Generated by RelativeCIDocumentationReport issue

Copy link
Copy Markdown
Collaborator

@Yradex Yradex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is a 0.5 KB increase in the React externals example bundle size expected?

@HuJean HuJean merged commit 7cb10db into main Apr 3, 2026
78 of 80 checks passed
@HuJean HuJean deleted the chore/runtime-vnode-constants branch April 3, 2026 06:02
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.

3 participants