fix(react/runtime): fix runOnBackground() failure in certain cases#1878
fix(react/runtime): fix runOnBackground() failure in certain cases#1878Yradex merged 1 commit intolynx-family:mainfrom
runOnBackground() failure in certain cases#1878Conversation
🦋 Changeset detectedLatest commit: d445fb1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
📝 WalkthroughWalkthroughAdds a changeset for a patch to @lynx-js/react and updates hydration logic to correctly handle main-thread functions created during initial render so they can call runOnBackground() post-hydration. Corresponding tests are expanded to assert hydration fields and delayed execution behavior. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related issues
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
React Example#5833 Bundle Size — 237.56KiB (0%).d445fb1(current) vs 7e06ca9 main#5831(baseline) Bundle metrics
|
| Current #5833 |
Baseline #5831 |
|
|---|---|---|
0B |
0B |
|
0B |
0B |
|
0% |
0% |
|
0 |
0 |
|
4 |
4 |
|
166 |
166 |
|
68 |
68 |
|
46.82% |
46.82% |
|
2 |
2 |
|
0 |
0 |
Bundle size by type no changes
| Current #5833 |
Baseline #5831 |
|
|---|---|---|
145.76KiB |
145.76KiB |
|
91.8KiB |
91.8KiB |
Bundle analysis report Branch Yradex:mts/fix-hydration Project dashboard
Generated by RelativeCI Documentation Report issue
CodSpeed Performance ReportMerging #1878 will degrade performances by 6.13%Comparing Summary
Benchmarks breakdown
Footnotes
|
Web Explorer#5829 Bundle Size — 364.3KiB (0%).d445fb1(current) vs 7e06ca9 main#5827(baseline) Bundle metrics
Bundle size by type
|
| Current #5829 |
Baseline #5827 |
|
|---|---|---|
238.5KiB |
238.5KiB |
|
93.8KiB |
93.8KiB |
|
32KiB |
32KiB |
Bundle analysis report Branch Yradex:mts/fix-hydration Project dashboard
Generated by RelativeCI Documentation Report issue
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @lynx-js/web-core@0.18.0 ### Minor Changes - fix: ([#1837](#1837)) 1. `LynxView.updateData()` cannot trigger `dataProcessor`. 2. **This is a break change:** The second parameter of `LynxView.updateData()` has been changed from `UpdateDataType` to `string`, which is the `processorName` (default is `default` which will use `defaultDataProcessor`). This change is to better align with Native. The current complete type is as follows: ```ts LynxView.updateData(data: Cloneable, processorName?: string | undefined, callback?: (() => void) | undefined): void ``` ### Patch Changes - Updated dependencies \[[`77397fd`](77397fd), [`7d90ed5`](7d90ed5)]: - @lynx-js/web-worker-runtime@0.18.0 - @lynx-js/web-constants@0.18.0 - @lynx-js/web-mainthread-apis@0.18.0 - @lynx-js/web-worker-rpc@0.18.0 ## @lynx-js/react@0.114.2 ### Patch Changes - fix: main thread functions created during the initial render cannot correctly call `runOnBackground()` after hydration ([#1878](#1878)) ## @lynx-js/rspeedy@0.11.6 ### Patch Changes - Should apply `dev.hmr` and `dev.liveReload` to Rsbuild config. ([#1882](#1882)) - Support CLI flag `--root` to specify the root of the project. ([#1836](#1836)) ## @lynx-js/react-rsbuild-plugin@0.11.2 ### Patch Changes - Fix using wrong version of `@lynx-js/react/refresh`. ([#1756](#1756)) - Updated dependencies \[]: - @lynx-js/react-alias-rsbuild-plugin@0.11.2 - @lynx-js/use-sync-external-store@1.5.0 - @lynx-js/react-refresh-webpack-plugin@0.3.4 - @lynx-js/react-webpack-plugin@0.7.1 ## @lynx-js/web-constants@0.18.0 ### Patch Changes - fix: ([#1837](#1837)) 1. `LynxView.updateData()` cannot trigger `dataProcessor`. 2. **This is a break change:** The second parameter of `LynxView.updateData()` has been changed from `UpdateDataType` to `string`, which is the `processorName` (default is `default` which will use `defaultDataProcessor`). This change is to better align with Native. The current complete type is as follows: ```ts LynxView.updateData(data: Cloneable, processorName?: string | undefined, callback?: (() => void) | undefined): void ``` - Updated dependencies \[]: - @lynx-js/web-worker-rpc@0.18.0 ## @lynx-js/web-elements@0.8.8 ### Patch Changes - fix: ([#1837](#1837)) 1. `LynxView.updateData()` cannot trigger `dataProcessor`. 2. **This is a break change:** The second parameter of `LynxView.updateData()` has been changed from `UpdateDataType` to `string`, which is the `processorName` (default is `default` which will use `defaultDataProcessor`). This change is to better align with Native. The current complete type is as follows: ```ts LynxView.updateData(data: Cloneable, processorName?: string | undefined, callback?: (() => void) | undefined): void ``` - Updated dependencies \[]: - @lynx-js/web-elements-template@0.8.8 ## @lynx-js/web-explorer@0.0.10 ### Patch Changes - chore: update `@lynx-js/lynx-core` to `0.1.3`, `@lynx-js/web-core` to `0.17.1`. ([#1839](#1839)) ## @lynx-js/web-mainthread-apis@0.18.0 ### Patch Changes - fix: ([#1837](#1837)) 1. `LynxView.updateData()` cannot trigger `dataProcessor`. 2. **This is a break change:** The second parameter of `LynxView.updateData()` has been changed from `UpdateDataType` to `string`, which is the `processorName` (default is `default` which will use `defaultDataProcessor`). This change is to better align with Native. The current complete type is as follows: ```ts LynxView.updateData(data: Cloneable, processorName?: string | undefined, callback?: (() => void) | undefined): void ``` - feat: mouse event output structures remain aligned ([#1820](#1820)) - Updated dependencies \[[`77397fd`](77397fd)]: - @lynx-js/web-constants@0.18.0 - @lynx-js/web-style-transformer@0.18.0 ## @lynx-js/web-worker-runtime@0.18.0 ### Patch Changes - fix: ([#1837](#1837)) 1. `LynxView.updateData()` cannot trigger `dataProcessor`. 2. **This is a break change:** The second parameter of `LynxView.updateData()` has been changed from `UpdateDataType` to `string`, which is the `processorName` (default is `default` which will use `defaultDataProcessor`). This change is to better align with Native. The current complete type is as follows: ```ts LynxView.updateData(data: Cloneable, processorName?: string | undefined, callback?: (() => void) | undefined): void ``` - Updated dependencies \[[`77397fd`](77397fd), [`7d90ed5`](7d90ed5)]: - @lynx-js/web-constants@0.18.0 - @lynx-js/web-mainthread-apis@0.18.0 - @lynx-js/web-worker-rpc@0.18.0 ## create-rspeedy@0.11.6 ## @lynx-js/react-alias-rsbuild-plugin@0.11.2 ## upgrade-rspeedy@0.11.6 ## @lynx-js/web-core-server@0.18.0 ## @lynx-js/web-elements-template@0.8.8 ## @lynx-js/web-rsbuild-server-middleware@0.18.0 ## @lynx-js/web-style-transformer@0.18.0 ## @lynx-js/web-worker-rpc@0.18.0 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Fixes #1875.
Summary by CodeRabbit
Bug Fixes
Tests
Chores
Checklist