Skip to content

feat(react): export use from @lynx-js/react/compat - #3672

Merged
upupming merged 1 commit into
feat/preact-v11from
feat/compat-use
Sep 1, 2026
Merged

feat(react): export use from @lynx-js/react/compat#3672
upupming merged 1 commit into
feat/preact-v11from
feat/compat-use

Conversation

@upupming

Copy link
Copy Markdown
Collaborator

Stacked on #3450 — review that one first; this branch targets feat/preact-v11 and will retarget to main once it lands.

What

Forward Preact's use through @lynx-js/react/compat, alongside the startTransition / useTransition that are already there.

Why

use reads a resource during render and, unlike the other hooks, may be called conditionally. Given a context it returns the current value; given a promise it returns the resolved value, suspending to the nearest Suspense boundary while pending. Preact has shipped it in compat all along — ReactLynx just never forwarded it, so cards had no way to reach it.

Tests

__test__/snapshot/compat/use.test.jsx covers both resource kinds against the real ReactLynx background runtime: a context read, the default value outside a provider, a conditional call, and a promise that suspends and then renders its resolved value.

The lazy-bundle variant (lazy/compat.js) and the export-count assertion in compat/export.test.jsx are updated to match.

@upupming
upupming requested review from HuJean, Yradex and hzy as code owners August 27, 2026 12:20
@coderabbitai

coderabbitai Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Team

Run ID: aa82b6d3-7b9e-404e-a478-bcc75704ad15

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

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.

@changeset-bot

changeset-bot Bot commented Aug 27, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 1412861

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

This PR includes changesets to release 2 packages
Name Type
@lynx-js/react Minor
@lynx-js/react-umd Minor

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

@pkg-pr-new

pkg-pr-new Bot commented Aug 27, 2026

Copy link
Copy Markdown
background-only

pnpm add https://pkg.pr.new/lynx-family/lynx-stack/background-only@1412861

@lynx-js/genui

pnpm add https://pkg.pr.new/lynx-family/lynx-stack/@lynx-js/genui@1412861

@lynx-js/react

pnpm add https://pkg.pr.new/lynx-family/lynx-stack/@lynx-js/react@1412861

@lynx-js/react-signals

pnpm add https://pkg.pr.new/lynx-family/lynx-stack/@lynx-js/react-signals@1412861

@lynx-js/react-umd

pnpm add https://pkg.pr.new/lynx-family/lynx-stack/@lynx-js/react-umd@1412861

@lynx-js/use-sync-external-store

pnpm add https://pkg.pr.new/lynx-family/lynx-stack/@lynx-js/use-sync-external-store@1412861

@lynx-js/debug-metadata-rsbuild-plugin

pnpm add https://pkg.pr.new/lynx-family/lynx-stack/@lynx-js/debug-metadata-rsbuild-plugin@1412861

@lynx-js/rsbuild-plugin

pnpm add https://pkg.pr.new/lynx-family/lynx-stack/@lynx-js/rsbuild-plugin@1412861

@lynx-js/react-rsbuild-plugin

pnpm add https://pkg.pr.new/lynx-family/lynx-stack/@lynx-js/react-rsbuild-plugin@1412861

@lynx-js/react-alias-rsbuild-plugin

pnpm add https://pkg.pr.new/lynx-family/lynx-stack/@lynx-js/react-alias-rsbuild-plugin@1412861

@lynx-js/websocket

pnpm add https://pkg.pr.new/lynx-family/lynx-stack/@lynx-js/websocket@1412861

@lynx-js/css-serializer

pnpm add https://pkg.pr.new/lynx-family/lynx-stack/@lynx-js/css-serializer@1412861

@lynx-js/debug-metadata

pnpm add https://pkg.pr.new/lynx-family/lynx-stack/@lynx-js/debug-metadata@1412861

@lynx-js/web-core

pnpm add https://pkg.pr.new/lynx-family/lynx-stack/@lynx-js/web-core@1412861

@lynx-js/web-elements

pnpm add https://pkg.pr.new/lynx-family/lynx-stack/@lynx-js/web-elements@1412861

@lynx-js/web-rsbuild-server-middleware

pnpm add https://pkg.pr.new/lynx-family/lynx-stack/@lynx-js/web-rsbuild-server-middleware@1412861

@lynx-js/web-worker-rpc

pnpm add https://pkg.pr.new/lynx-family/lynx-stack/@lynx-js/web-worker-rpc@1412861

@lynx-js/cache-events-webpack-plugin

pnpm add https://pkg.pr.new/lynx-family/lynx-stack/@lynx-js/cache-events-webpack-plugin@1412861

@lynx-js/chunk-loading-webpack-plugin

pnpm add https://pkg.pr.new/lynx-family/lynx-stack/@lynx-js/chunk-loading-webpack-plugin@1412861

@lynx-js/css-extract-webpack-plugin

pnpm add https://pkg.pr.new/lynx-family/lynx-stack/@lynx-js/css-extract-webpack-plugin@1412861

@lynx-js/react-refresh-webpack-plugin

pnpm add https://pkg.pr.new/lynx-family/lynx-stack/@lynx-js/react-refresh-webpack-plugin@1412861

@lynx-js/react-webpack-plugin

pnpm add https://pkg.pr.new/lynx-family/lynx-stack/@lynx-js/react-webpack-plugin@1412861

@lynx-js/runtime-wrapper-webpack-plugin

pnpm add https://pkg.pr.new/lynx-family/lynx-stack/@lynx-js/runtime-wrapper-webpack-plugin@1412861

@lynx-js/template-webpack-plugin

pnpm add https://pkg.pr.new/lynx-family/lynx-stack/@lynx-js/template-webpack-plugin@1412861

@lynx-js/webpack-dev-transport

pnpm add https://pkg.pr.new/lynx-family/lynx-stack/@lynx-js/webpack-dev-transport@1412861

@lynx-js/webpack-runtime-globals

pnpm add https://pkg.pr.new/lynx-family/lynx-stack/@lynx-js/webpack-runtime-globals@1412861

commit: 1412861

@codecov

codecov Bot commented Aug 27, 2026

Copy link
Copy Markdown

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

relativeci Bot commented Aug 27, 2026

Copy link
Copy Markdown

React MTF Example

#4966 Bundle Size — 210.53KiB (0%).

1412861(current) vs fdfdfdd feat/preact-v11#4962(baseline)

Bundle metrics  no changes
                 Current
#4966
     Baseline
#4962
No change  Initial JS 0B 0B
No change  Initial CSS 0B 0B
Change  Cache Invalidation 0% 47.04%
No change  Chunks 0 0
No change  Assets 3 3
No change  Modules 215 215
No change  Duplicate Modules 82 82
No change  Duplicate Code 42.99% 42.99%
No change  Packages 2 2
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#4966
     Baseline
#4962
No change  IMG 111.23KiB 111.23KiB
No change  Other 99.3KiB 99.3KiB

Bundle analysis reportBranch feat/compat-useProject dashboard


Generated by RelativeCIDocumentationReport issue

@relativeci

relativeci Bot commented Aug 27, 2026

Copy link
Copy Markdown

Web Explorer

#13435 Bundle Size — 1.29MiB (0%).

1412861(current) vs fdfdfdd feat/preact-v11#13431(baseline)

Bundle metrics  Change 2 changes
                 Current
#13435
     Baseline
#13431
No change  Initial JS 45.99KiB 45.99KiB
No change  Initial CSS 2.37KiB 2.37KiB
Change  Cache Invalidation 0% 16.76%
No change  Chunks 11 11
No change  Assets 13 13
Change  Modules 322(+0.63%) 320
No change  Duplicate Modules 15 15
Change  Duplicate Code 19.36%(-0.05%) 19.37%
No change  Packages 14 14
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#13435
     Baseline
#13431
No change  JS 756.75KiB 756.75KiB
No change  Other 564.93KiB 564.93KiB
No change  CSS 2.37KiB 2.37KiB

Bundle analysis reportBranch feat/compat-useProject dashboard


Generated by RelativeCIDocumentationReport issue

@relativeci

relativeci Bot commented Aug 27, 2026

Copy link
Copy Markdown

React Example with Element Template

#4106 Bundle Size — 227.23KiB (0%).

1412861(current) vs fdfdfdd feat/preact-v11#4102(baseline)

Bundle metrics  no changes
                 Current
#4106
     Baseline
#4102
No change  Initial JS 0B 0B
No change  Initial CSS 0B 0B
Change  Cache Invalidation 0% 35.79%
No change  Chunks 0 0
No change  Assets 4 4
No change  Modules 175 175
No change  Duplicate Modules 62 62
No change  Duplicate Code 36.46% 36.46%
No change  Packages 2 2
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#4106
     Baseline
#4102
No change  IMG 145.76KiB 145.76KiB
No change  Other 81.47KiB 81.47KiB

Bundle analysis reportBranch feat/compat-useProject dashboard


Generated by RelativeCIDocumentationReport issue

@relativeci

relativeci Bot commented Aug 27, 2026

Copy link
Copy Markdown

React Example

#11848 Bundle Size — 239.05KiB (0%).

1412861(current) vs fdfdfdd feat/preact-v11#11844(baseline)

Bundle metrics  no changes
                 Current
#11848
     Baseline
#11844
No change  Initial JS 0B 0B
No change  Initial CSS 0B 0B
Change  Cache Invalidation 0% 38.96%
No change  Chunks 0 0
No change  Assets 4 4
No change  Modules 220 220
No change  Duplicate Modules 85 85
No change  Duplicate Code 43.55% 43.55%
No change  Packages 2 2
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#11848
     Baseline
#11844
No change  IMG 145.76KiB 145.76KiB
No change  Other 93.29KiB 93.29KiB

Bundle analysis reportBranch feat/compat-useProject dashboard


Generated by RelativeCIDocumentationReport issue

@codspeed-hq

codspeed-hq Bot commented Aug 27, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 6.25%

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

#### 🎉 Hooray! `codspeed-node` just leveled up to 5.7.1!

A heads-up, this is a breaking change and it might affect your current performance baseline a bit. But here's the exciting part - it's packed with new, cool features and promises improved result stability 🥳!
Curious about what's new? Visit our releases page to delve into all the awesome details about this new version.

⚡ 2 improved benchmarks
✅ 266 untouched benchmarks
⏩ 26 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
WallTime 003-hello-list__main-thread-processData 1.8 µs 1.6 µs +6.7%
WallTime 007-four-layer-views__main-thread-processData 1.6 µs 1.6 µs +5.8%

Tip

Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.


Comparing feat/compat-use (1412861) with feat/preact-v11 (fdfdfdd)

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.

@relativeci

relativeci Bot commented Aug 27, 2026

Copy link
Copy Markdown

React External

#4947 Bundle Size — 583.86KiB (+0.13%).

1412861(current) vs fdfdfdd feat/preact-v11#4943(baseline)

Bundle metrics  Change 3 changes
                 Current
#4947
     Baseline
#4943
No change  Initial JS 0B 0B
No change  Initial CSS 0B 0B
Change  Cache Invalidation 29.51% 31.93%
No change  Chunks 0 0
No change  Assets 3 3
Change  Modules 19(-5%) 20
No change  Duplicate Modules 5 5
Change  Duplicate Code 4.98%(+28.35%) 3.88%
No change  Packages 0 0
No change  Duplicate Packages 0 0
Bundle size by type  Change 1 change Regression 1 regression
                 Current
#4947
     Baseline
#4943
Regression  Other 583.86KiB (+0.13%) 583.11KiB

Bundle analysis reportBranch feat/compat-useProject dashboard


Generated by RelativeCIDocumentationReport issue

@upupming
upupming force-pushed the feat/compat-use branch 2 times, most recently from df98d63 to a329f3b Compare August 31, 2026 02:52
Preact ships `use` in compat but ReactLynx did not forward it, so cards
could not read a promise or a context during render.

Covers both resources: a context read (including the default value and a
conditional call) and a promise that suspends to a Suspense boundary and
then renders its resolved value.
@upupming
upupming merged commit 472cf3b into main Sep 1, 2026
74 of 82 checks passed
@upupming
upupming deleted the feat/compat-use branch September 1, 2026 09:04
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