Skip to content

refactor(react): move runtime hooks out of snapshot#2529

Merged
HuJean merged 4 commits intolynx-family:mainfrom
Yradex:wt/runtime-core-shared-main
Apr 29, 2026
Merged

refactor(react): move runtime hooks out of snapshot#2529
HuJean merged 4 commits intolynx-family:mainfrom
Yradex:wt/runtime-core-shared-main

Conversation

@Yradex
Copy link
Copy Markdown
Collaborator

@Yradex Yradex commented Apr 27, 2026

Summary by CodeRabbit

  • Chores

    • Reorganized internal module structure for better code maintainability and clarity.
    • Consolidated shared utilities and constants to reduce duplication.
    • Enhanced hook initialization mechanism to prevent redundant installations.
    • Updated test infrastructure and module resolution configuration.
  • Refactor

    • Restructured hook implementations for improved organization and performance.

Overview

This refactors runtime-owned ReactLynx hooks and supporting Preact integration helpers out of the Snapshot directory so Snapshot no longer appears to own behavior that is shared by multiple runtime backends.

The public imports stay the same, but their package export targets now resolve through runtime/lib/core/hooks/* instead of runtime/lib/snapshot/hooks/*.

Key Points

  • Moves ReactLynx hook implementations into src/core/hooks, making hooks a runtime core API surface rather than a Snapshot backend detail.
  • Moves common Preact integration helpers into src/shared, including render constants, component stack tracking, and profiling bridge helpers used by hooks and Snapshot debug/runtime modules.
  • Updates tests and guardrails so core and shared may be consumed by runtime backends, while preventing those directories from depending back on Snapshot or Element Template code.

Compatibility / Boundaries

Public package entrypoints are preserved:

import { useState } from '@lynx-js/react/hooks';
import { useState as useMainThreadState } from '@lynx-js/react/lepus/hooks';

Only the internal export targets change:

runtime/lib/snapshot/hooks/* -> runtime/lib/core/hooks/*

core now owns ReactLynx runtime semantics such as hooks. shared contains lower-level runtime support used across modules, and must remain backend-neutral.

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

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 27, 2026

🦋 Changeset detected

Latest commit: 3baf3cf

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 27, 2026

📝 Walkthrough

Walkthrough

This PR refactors the React runtime by migrating hooks from snapshot-specific modules to a new core module hierarchy. Shared utilities (profiling, render constants, component stack) are consolidated into a shared directory. Package exports, test files, and internal imports are updated to reference the new module structure throughout the codebase.

Changes

Cohort / File(s) Summary
Module structure & package exports
packages/react/package.json, packages/react/runtime/src/index.ts, packages/react/runtime/src/lynx-api.ts, packages/react/runtime/src/lynx.ts, packages/react/types/react.docs.d.ts
Redirect exports and re-exports from snapshot/hooks to core/hooks; update package.json export mappings and typesVersions to point to runtime/lib/core/hooks/* instead of snapshot paths.
Core hooks implementation
packages/react/runtime/src/core/hooks/mainThread.ts, packages/react/runtime/src/core/hooks/mainThreadImpl.ts, packages/react/runtime/src/core/hooks/react.ts, packages/react/runtime/src/core/hooks/useLynxGlobalEventListener.ts
Introduce core hooks modules; refactor mainThreadImpl.ts to export installMainThreadHooks() function ensuring hooks are installed exactly once; relocate profile helper import source.
Shared utilities
packages/react/runtime/src/shared/profile.ts, packages/react/runtime/src/shared/component-stack.ts, packages/react/runtime/src/shared/render-constants.js
Create or consolidate shared modules for profiling, component stack, and render constants; add explicit type annotation for profileFlowId; add local noop utilities.
Snapshot module rewiring
packages/react/runtime/src/snapshot/*/... (30+ files)`
Update all snapshot module imports to source render constants from shared/render-constants.js and profiling utilities from shared/profile.js instead of snapshot-specific paths; update compat/initData.ts to import hooks from core.
Internal/legacy rewiring
packages/react/runtime/src/internal.ts, packages/react/runtime/src/snapshot/legacy-react-runtime/index.ts, packages/react/runtime/src/snapshot/worklet/ref/workletRef.ts, packages/react/runtime/src/utils.ts
Redirect hook and utility imports to core/shared modules; update re-exports to new locations.
Test infrastructure
packages/react/runtime/vitest.config.ts
Refactor preact module resolution to use internal preact builds; update alias configuration from object to array format; adjust coverage exclusions to include new shared modules.
Test suite updates
packages/react/runtime/__test__/core/hooks/*, packages/react/runtime/__test__/shared/*, packages/react/runtime/__test__/snapshot/*/... (15+ files)
Update test imports to reference new core/shared module locations; refactor some tests to dynamically import preact and use helpers; add test for duplicate hook installation prevention.
Guardrails & validation
packages/react/runtime/__test__/guardrails/snapshot-containment.test.ts
Expand snapshot containment checks: remove hooks from legacy directory allowlist; skip src/element-template in old-implementation scans; add enforcement that src/core and src/shared cannot import from snapshot/element-template backends; assert hooks are in src/core rather than src/snapshot; update typesVersions expectation.
Plugin test expectations
packages/rspeedy/plugin-react-alias/test/index.test.ts
Update expected paths in alias resolver tests to reference runtime/lib/core/hooks/* instead of runtime/lib/snapshot/hooks/*.
New event-mode tests
packages/react/runtime/__test__/snapshot/lifecycle/updateGlobalProps.event.test.jsx
Add new test suite validating global props updates in event mode using GlobalPropsProvider/GlobalPropsConsumer and useGlobalProps.
Changeset
.changeset/plain-lions-hope.md
Empty changeset file with placeholder YAML frontmatter.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • HuJean
  • hzy

Poem

🐰 Hooks hop from snapshot's nest to core,
Shared utilities dance on every floor,
Tests now find their way with grace,
Module paths in their rightful place!
A refactor complete, the journey's through,
ReactLynx shines, forever new! 🌟

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 10.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'refactor(react): move runtime hooks out of snapshot' directly and clearly summarizes the main change: moving ReactLynx hooks from the snapshot directory to the core hooks directory.
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.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 27, 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 27, 2026

Merging this PR will degrade performance by 8.26%

⚡ 1 improved benchmark
❌ 1 regressed benchmark
✅ 79 untouched benchmarks
⏩ 26 skipped benchmarks1

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

Performance Changes

Benchmark BASE HEAD Efficiency
002-hello-reactLynx-destroyBackground 894.9 µs 670.3 µs +33.5%
transform 1000 view elements 43 ms 46.8 ms -8.26%

Comparing Yradex:wt/runtime-core-shared-main (3baf3cf) with main (5b57e36)2

Open in CodSpeed

Footnotes

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

  2. No successful run was found on main (f6d7177) during the generation of this report, so 5b57e36 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@relativeci
Copy link
Copy Markdown

relativeci Bot commented Apr 27, 2026

React Example

#7656 Bundle Size — 225.43KiB (+0.02%).

3baf3cf(current) vs f6d7177 main#7646(baseline)

Bundle metrics  Change 3 changes
                 Current
#7656
     Baseline
#7646
No change  Initial JS 0B 0B
No change  Initial CSS 0B 0B
Change  Cache Invalidation 35.33% 0%
No change  Chunks 0 0
No change  Assets 4 4
Change  Modules 180(+0.56%) 179
No change  Duplicate Modules 69 69
Change  Duplicate Code 44.54%(-0.07%) 44.57%
No change  Packages 2 2
No change  Duplicate Packages 0 0
Bundle size by type  Change 1 change Regression 1 regression
                 Current
#7656
     Baseline
#7646
No change  IMG 145.76KiB 145.76KiB
Regression  Other 79.67KiB (+0.05%) 79.63KiB

Bundle analysis reportBranch Yradex:wt/runtime-core-shared-ma...Project dashboard


Generated by RelativeCIDocumentationReport issue

@relativeci
Copy link
Copy Markdown

relativeci Bot commented Apr 27, 2026

Web Explorer

#9229 Bundle Size — 900.02KiB (0%).

3baf3cf(current) vs f6d7177 main#9219(baseline)

Bundle metrics  Change 2 changes
                 Current
#9229
     Baseline
#9219
No change  Initial JS 44.46KiB 44.46KiB
No change  Initial CSS 2.22KiB 2.22KiB
No change  Cache Invalidation 0% 0%
No change  Chunks 9 9
No change  Assets 11 11
Change  Modules 230(+0.88%) 228
No change  Duplicate Modules 11 11
Change  Duplicate Code 27.28%(-0.04%) 27.29%
No change  Packages 10 10
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#9229
     Baseline
#9219
No change  JS 495.88KiB 495.88KiB
No change  Other 401.92KiB 401.92KiB
No change  CSS 2.22KiB 2.22KiB

Bundle analysis reportBranch Yradex:wt/runtime-core-shared-ma...Project dashboard


Generated by RelativeCIDocumentationReport issue

@relativeci
Copy link
Copy Markdown

relativeci Bot commented Apr 27, 2026

React MTF Example

#788 Bundle Size — 196.58KiB (+0.02%).

3baf3cf(current) vs f6d7177 main#778(baseline)

Bundle metrics  Change 3 changes
                 Current
#788
     Baseline
#778
No change  Initial JS 0B 0B
No change  Initial CSS 0B 0B
Change  Cache Invalidation 43.4% 0%
No change  Chunks 0 0
No change  Assets 3 3
Change  Modules 174(+0.58%) 173
No change  Duplicate Modules 66 66
Change  Duplicate Code 44.04%(-0.09%) 44.08%
No change  Packages 2 2
No change  Duplicate Packages 0 0
Bundle size by type  Change 1 change Regression 1 regression
                 Current
#788
     Baseline
#778
No change  IMG 111.23KiB 111.23KiB
Regression  Other 85.35KiB (+0.05%) 85.31KiB

Bundle analysis reportBranch Yradex:wt/runtime-core-shared-ma...Project dashboard


Generated by RelativeCIDocumentationReport issue

@relativeci
Copy link
Copy Markdown

relativeci Bot commented Apr 27, 2026

React External

#772 Bundle Size — 680.41KiB (+0.02%).

3baf3cf(current) vs f6d7177 main#763(baseline)

Bundle metrics  Change 1 change
                 Current
#772
     Baseline
#763
No change  Initial JS 0B 0B
No change  Initial CSS 0B 0B
Change  Cache Invalidation 39.7% 0%
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
#772
     Baseline
#763
Regression  Other 680.41KiB (+0.02%) 680.27KiB

Bundle analysis reportBranch Yradex:wt/runtime-core-shared-ma...Project dashboard


Generated by RelativeCIDocumentationReport issue

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (3)
packages/react/runtime/src/shared/profile.ts (1)

5-8: Optional: unify the wrapper pattern across the three exports.

profileStart and profileEnd still use the trailing as typeof lynx.performance.profileX cast on a double-IIFE pattern, while profileFlowId now uses a leading type annotation on a single IIFE. Both work, but the inconsistency is a minor readability nit; consider applying the same shape to all three.

Also, inlining noop/noopFlowId here (rather than importing noop from ../utils.js) is the right call given the new layering rules — shared/ should not depend on runtime-root modules — so this duplication is intentional and acceptable.

♻️ Example: align profileStart/profileEnd with the profileFlowId pattern
-export const profileStart = /* `@__PURE__` */ ((() => {
-  let p;
-  if (!(p = lynx.performance) || typeof p.profileStart !== 'function') {
-    return noop;
-  }
-  return p.profileStart.bind(p);
-})()) as typeof lynx.performance.profileStart;
-
-export const profileEnd = /* `@__PURE__` */ ((() => {
-  let p;
-  if (!(p = lynx.performance) || typeof p.profileEnd !== 'function') {
-    return noop;
-  }
-  return p.profileEnd.bind(p);
-})()) as typeof lynx.performance.profileEnd;
+export const profileStart: typeof lynx.performance.profileStart = /* `@__PURE__` */ (() => {
+  let p;
+  if (!(p = lynx.performance) || typeof p.profileStart !== 'function') {
+    return noop;
+  }
+  return p.profileStart.bind(p);
+})();
+
+export const profileEnd: typeof lynx.performance.profileEnd = /* `@__PURE__` */ (() => {
+  let p;
+  if (!(p = lynx.performance) || typeof p.profileEnd !== 'function') {
+    return noop;
+  }
+  return p.profileEnd.bind(p);
+})();

Also applies to: 30-36

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/react/runtime/src/shared/profile.ts` around lines 5 - 8, Unify the
wrapper pattern by changing profileStart and profileEnd to the same single-IIFE
leading type-annotation style used by profileFlowId: declare const profileStart:
typeof lynx.performance.profileStart = (() => { ... })(); and const profileEnd:
typeof lynx.performance.profileEnd = (() => { ... })(); remove the trailing "as
typeof ..." casts and the double-IIFE pattern, keep the local noop and
noopFlowId definitions as-is, and ensure each IIFE returns the appropriate
function implementation matching lynx.performance.profileX signatures.
packages/react/runtime/src/core/hooks/mainThreadImpl.ts (1)

44-47: Nit: prefer locals over module-level let for captured handlers.

oldBeforeDiff/oldBeforeRender/oldAfterDiff/oldRoot are only read from closures created inside installMainThreadHooks and never reassigned after install. Hoisting them to module scope just widens visibility and keeps stale references alive. Consider declaring them as const inside the function:

♻️ Proposed cleanup
-let hooksInstalled = false;
-let oldBeforeDiff: ((vnode: any) => void) | undefined;
-let oldBeforeRender: ((vnode: any) => void) | undefined;
-let oldAfterDiff: ((vnode: any) => void) | undefined;
-let oldRoot: ((vnode: any, parentDom: any) => void) | undefined;
-
-function installMainThreadHooks(): void {
-  if (hooksInstalled) {
-    return;
-  }
-  hooksInstalled = true;
-  oldBeforeDiff = options[DIFF];
-  oldBeforeRender = options[RENDER];
-  oldAfterDiff = options[DIFFED];
-  oldRoot = options[ROOT];
+let hooksInstalled = false;
+
+function installMainThreadHooks(): void {
+  if (hooksInstalled) {
+    return;
+  }
+  hooksInstalled = true;
+  const oldBeforeDiff = options[DIFF];
+  const oldBeforeRender = options[RENDER];
+  const oldAfterDiff = options[DIFFED];
+  const oldRoot = options[ROOT];
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/react/runtime/src/core/hooks/mainThreadImpl.ts` around lines 44 -
47, The module-level mutable bindings oldBeforeDiff, oldBeforeRender,
oldAfterDiff, and oldRoot are only captured by closures in
installMainThreadHooks and never reassigned, so move them inside
installMainThreadHooks and declare them as const locals to limit scope and avoid
keeping stale module-level references; update any closures inside
installMainThreadHooks to reference the new local consts (preserving their
initialization from the original preact hooks) and remove the module-level
declarations.
packages/react/runtime/__test__/snapshot/lifecycle/updateGlobalProps.test.jsx (1)

30-38: Optional: hoist the dynamic imports out of renderWithCurrentPreact.

Each call dynamically re-imports preact and ./document. With multiple background-render call sites (5 in this file) the helper does redundant Promise.all work and re-runs setupBackgroundDocument() on every render. Consider doing the imports once at module top-level (or memoizing inside the helper) so each render call only does the assignment + render.

♻️ Sketch
-async function renderWithCurrentPreact(element, root) {
-  const [preact, { document, setupBackgroundDocument }] = await Promise.all([
-    import('preact'),
-    import('../../../src/document'),
-  ]);
-  setupBackgroundDocument();
-  preact.options.document = document;
-  preact.render(element, root);
-}
+let preactRenderSetup;
+async function renderWithCurrentPreact(element, root) {
+  preactRenderSetup ??= (async () => {
+    const [preact, { document, setupBackgroundDocument }] = await Promise.all([
+      import('preact'),
+      import('../../../src/document'),
+    ]);
+    setupBackgroundDocument();
+    preact.options.document = document;
+    return preact;
+  })();
+  const preact = await preactRenderSetup;
+  preact.render(element, root);
+}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@packages/react/runtime/__test__/snapshot/lifecycle/updateGlobalProps.test.jsx`
around lines 30 - 38, The helper renderWithCurrentPreact repeatedly re-imports
preact and ../../../src/document and re-runs setupBackgroundDocument on each
call; hoist the dynamic imports out of renderWithCurrentPreact (or memoize them)
so the module does the Promise.all once at top-level: import preact and the
document module (or create cached vars for them), call setupBackgroundDocument
once, then have renderWithCurrentPreact only perform preact.options.document =
document and preact.render(element, root); ensure you reference the existing
symbols renderWithCurrentPreact, setupBackgroundDocument,
preact.options.document, and the dynamic imports import('preact') /
import('../../../src/document') when moving the logic.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/react/package.json`:
- Around line 62-65: Create a new type declaration (e.g.,
runtime/lib/core/hooks/mainThread.d.ts) that reflects the noop implementations
for useEffect, useLayoutEffect, and useImperativeHandle (the no-op stubs in
mainThreadImpl.ts lines ~213-215) by typing them as returning void or adding
JSDoc deprecation/runtime-warning comments; then update the package.json exports
entry for "./lepus/hooks" (currently pointing to
runtime/lib/core/hooks/react.d.ts) to point its "types" to the new
mainThread.d.ts and also update the corresponding typesVersions mapping to
reference the new file so consumers of `@lynx-js/react/lepus/hooks` get accurate
typings for the noop runtime.

In
`@packages/react/runtime/__test__/snapshot/lifecycle/updateGlobalProps.test.jsx`:
- Line 386: The tests import '../../../src/lynx-api?global-props-event' and rely
on distinct module instances, but Vitest ignores query params and caches the
module (so the shared _GlobalProps singleton gets the first-set
__GLOBAL_PROPS_MODE__); fix by calling vi.resetModules() before each test (or
immediately before the import) so the module cache is cleared and each import
re-evaluates a fresh _GlobalProps instance—add vi.resetModules() in the
beforeEach or directly above the import that references
'../../../src/lynx-api?global-props-event' and similarly for
'?global-props-provider-event'.

---

Nitpick comments:
In
`@packages/react/runtime/__test__/snapshot/lifecycle/updateGlobalProps.test.jsx`:
- Around line 30-38: The helper renderWithCurrentPreact repeatedly re-imports
preact and ../../../src/document and re-runs setupBackgroundDocument on each
call; hoist the dynamic imports out of renderWithCurrentPreact (or memoize them)
so the module does the Promise.all once at top-level: import preact and the
document module (or create cached vars for them), call setupBackgroundDocument
once, then have renderWithCurrentPreact only perform preact.options.document =
document and preact.render(element, root); ensure you reference the existing
symbols renderWithCurrentPreact, setupBackgroundDocument,
preact.options.document, and the dynamic imports import('preact') /
import('../../../src/document') when moving the logic.

In `@packages/react/runtime/src/core/hooks/mainThreadImpl.ts`:
- Around line 44-47: The module-level mutable bindings oldBeforeDiff,
oldBeforeRender, oldAfterDiff, and oldRoot are only captured by closures in
installMainThreadHooks and never reassigned, so move them inside
installMainThreadHooks and declare them as const locals to limit scope and avoid
keeping stale module-level references; update any closures inside
installMainThreadHooks to reference the new local consts (preserving their
initialization from the original preact hooks) and remove the module-level
declarations.

In `@packages/react/runtime/src/shared/profile.ts`:
- Around line 5-8: Unify the wrapper pattern by changing profileStart and
profileEnd to the same single-IIFE leading type-annotation style used by
profileFlowId: declare const profileStart: typeof lynx.performance.profileStart
= (() => { ... })(); and const profileEnd: typeof lynx.performance.profileEnd =
(() => { ... })(); remove the trailing "as typeof ..." casts and the double-IIFE
pattern, keep the local noop and noopFlowId definitions as-is, and ensure each
IIFE returns the appropriate function implementation matching
lynx.performance.profileX signatures.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 28391a48-3602-49ba-ab00-197ccb00c310

📥 Commits

Reviewing files that changed from the base of the PR and between f6d7177 and f371f22.

📒 Files selected for processing (52)
  • .changeset/plain-lions-hope.md
  • packages/react/package.json
  • packages/react/runtime/__test__/core/hooks/mainThread.test.tsx
  • packages/react/runtime/__test__/core/hooks/useLynxGlobalEventListener.test.jsx
  • packages/react/runtime/__test__/guardrails/snapshot-containment.test.ts
  • packages/react/runtime/__test__/shared/profile.test.ts
  • packages/react/runtime/__test__/snapshot/debug/backgroundSnapshot-profile.test.jsx
  • packages/react/runtime/__test__/snapshot/debug/profile.test.jsx
  • packages/react/runtime/__test__/snapshot/debug/react-hooks-profile.test.jsx
  • packages/react/runtime/__test__/snapshot/debug/vnodeSource.test.ts
  • packages/react/runtime/__test__/snapshot/event.test.jsx
  • packages/react/runtime/__test__/snapshot/lifecycle.test.jsx
  • packages/react/runtime/__test__/snapshot/lifecycle/destroy.test.jsx
  • packages/react/runtime/__test__/snapshot/lifecycle/updateGlobalProps.test.jsx
  • packages/react/runtime/src/core/hooks/mainThread.ts
  • packages/react/runtime/src/core/hooks/mainThreadImpl.ts
  • packages/react/runtime/src/core/hooks/react.ts
  • packages/react/runtime/src/core/hooks/useLynxGlobalEventListener.ts
  • packages/react/runtime/src/index.ts
  • packages/react/runtime/src/internal.ts
  • packages/react/runtime/src/lynx-api.ts
  • packages/react/runtime/src/lynx.ts
  • packages/react/runtime/src/shared/component-stack.ts
  • packages/react/runtime/src/shared/profile.ts
  • packages/react/runtime/src/shared/render-constants.ts
  • packages/react/runtime/src/snapshot/alog/elementPAPICall.ts
  • packages/react/runtime/src/snapshot/alog/render.ts
  • packages/react/runtime/src/snapshot/compat/initData.ts
  • packages/react/runtime/src/snapshot/debug/profileHooks.ts
  • packages/react/runtime/src/snapshot/debug/vnodeSource.ts
  • packages/react/runtime/src/snapshot/legacy-react-runtime/index.ts
  • packages/react/runtime/src/snapshot/lifecycle/destroy.ts
  • packages/react/runtime/src/snapshot/lifecycle/event/jsReady.ts
  • packages/react/runtime/src/snapshot/lifecycle/isRendering.ts
  • packages/react/runtime/src/snapshot/lifecycle/patch/commit.ts
  • packages/react/runtime/src/snapshot/lifecycle/reload.ts
  • packages/react/runtime/src/snapshot/lifecycle/render.ts
  • packages/react/runtime/src/snapshot/list/listUpdateInfo.ts
  • packages/react/runtime/src/snapshot/lynx/component.ts
  • packages/react/runtime/src/snapshot/lynx/env.ts
  • packages/react/runtime/src/snapshot/lynx/performance.ts
  • packages/react/runtime/src/snapshot/lynx/runWithForce.ts
  • packages/react/runtime/src/snapshot/lynx/tt.ts
  • packages/react/runtime/src/snapshot/renderToOpcodes/hydrate.ts
  • packages/react/runtime/src/snapshot/renderToOpcodes/index.ts
  • packages/react/runtime/src/snapshot/renderToOpcodes/opcodes.ts
  • packages/react/runtime/src/snapshot/snapshot/backgroundSnapshot.ts
  • packages/react/runtime/src/snapshot/worklet/ref/workletRef.ts
  • packages/react/runtime/src/utils.ts
  • packages/react/runtime/vitest.config.ts
  • packages/react/types/react.docs.d.ts
  • packages/rspeedy/plugin-react-alias/test/index.test.ts

Comment thread packages/react/package.json
Comment thread packages/react/runtime/__test__/snapshot/lifecycle/updateGlobalProps.test.jsx Outdated
@Yradex Yradex marked this pull request as ready for review April 27, 2026 08:55
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@packages/react/runtime/__test__/snapshot/lifecycle/updateGlobalProps.event.test.jsx`:
- Around line 125-139: Update the test's description string in the it(...) block
so it correctly reflects what's being exercised: replace the phrase mentioning
useGlobalProps with GlobalPropsConsumer. Locate the it(...) test that defines
Comp and imports GlobalPropsProvider and GlobalPropsConsumer (symbols:
GlobalPropsProvider, GlobalPropsConsumer, Comp) and change the description to
say it tests GlobalPropsProvider and GlobalPropsConsumer to keep the message
consistent with the test body.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b0686b61-9c4f-40ae-aec6-8bbe94bd4085

📥 Commits

Reviewing files that changed from the base of the PR and between f371f22 and 3baf3cf.

📒 Files selected for processing (4)
  • packages/react/runtime/__test__/core/hooks/mainThread.test.tsx
  • packages/react/runtime/__test__/snapshot/lifecycle/updateGlobalProps.event.test.jsx
  • packages/react/runtime/__test__/snapshot/lifecycle/updateGlobalProps.test.jsx
  • packages/react/runtime/vitest.config.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/react/runtime/test/core/hooks/mainThread.test.tsx
  • packages/react/runtime/test/snapshot/lifecycle/updateGlobalProps.test.jsx

@HuJean HuJean merged commit caadd3b into lynx-family:main Apr 29, 2026
105 of 112 checks passed
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