Skip to content

fix(react): silence invalid worklet warnings#2586

Merged
Yradex merged 1 commit into
lynx-family:mainfrom
Yradex:wt/remove-invalid-mtf-warn-20260509
May 9, 2026
Merged

fix(react): silence invalid worklet warnings#2586
Yradex merged 1 commit into
lynx-family:mainfrom
Yradex:wt/remove-invalid-mtf-warn-20260509

Conversation

@Yradex
Copy link
Copy Markdown
Collaborator

@Yradex Yradex commented May 9, 2026

Summary by CodeRabbit

Bug Fixes

  • Removed the "Invalid function object" console warning that appeared when worklet runtime encountered invalid, null, or undefined handler functions. Invalid worklet contexts continue to be properly rejected; only the diagnostic message has been eliminated to reduce unnecessary console output.

Overview

  • runWorklet can receive invalid or missing main-thread function objects when optional/nullish handlers flow through the worklet event path.
  • Those values are still ignored by returning early, but the runtime no longer emits the noisy MainThreadFunction: Invalid function object warning.

Key Points

  • The invalid ctx guard keeps the same control flow: values without _wkltId or _lepusWorkletHash return without executing a worklet.
  • The console side effect and its JSON.stringify(ctx) work were removed from that early-return path.
  • The focused runtime test now asserts invalid ctx values do not throw and do not warn.

For example, an event value shaped like { _workletType: "main-thread" } is still treated as non-executable worklet ctx, but it is ignored silently instead of surfacing a developer-console warning.

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 May 9, 2026

🦋 Changeset detected

Latest commit: 041d9af

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 Patch
@lynx-js/react-umd 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
Copy Markdown
Contributor

coderabbitai Bot commented May 9, 2026

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix(react): silence invalid worklet warnings' clearly and concisely summarizes the main change: removing/suppressing noisy console warnings when runWorklet receives invalid worklet contexts.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ 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 May 9, 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 May 9, 2026

Merging this PR will degrade performance by 14.67%

⚠️ 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
✅ 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 912.5 µs 863.5 µs +5.67%
transform 1000 view elements 40 ms 46.9 ms -14.67%

Comparing Yradex:wt/remove-invalid-mtf-warn-20260509 (041d9af) with main (5b6a33d)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 (60a345b) during the generation of this report, so 5b6a33d 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 May 9, 2026

React External

#1065 Bundle Size — 690.27KiB (0%).

041d9af(current) vs 60a345b main#1064(baseline)

Bundle metrics  no changes
                 Current
#1065
     Baseline
#1064
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 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  no changes
                 Current
#1065
     Baseline
#1064
No change  Other 690.27KiB 690.27KiB

Bundle analysis reportBranch Yradex:wt/remove-invalid-mtf-war...Project dashboard


Generated by RelativeCIDocumentationReport issue

@relativeci
Copy link
Copy Markdown

relativeci Bot commented May 9, 2026

React Example

#7950 Bundle Size — 235.77KiB (0%).

041d9af(current) vs 60a345b main#7948(baseline)

Bundle metrics  no changes
                 Current
#7950
     Baseline
#7948
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 197 197
No change  Duplicate Modules 80 80
No change  Duplicate Code 44.85% 44.85%
No change  Packages 2 2
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#7950
     Baseline
#7948
No change  IMG 145.76KiB 145.76KiB
No change  Other 90.01KiB 90.01KiB

Bundle analysis reportBranch Yradex:wt/remove-invalid-mtf-war...Project dashboard


Generated by RelativeCIDocumentationReport issue

@relativeci
Copy link
Copy Markdown

relativeci Bot commented May 9, 2026

React Example with Element Template

#215 Bundle Size — 198.02KiB (0%).

041d9af(current) vs 60a345b main#214(baseline)

Bundle metrics  Change 2 changes
                 Current
#215
     Baseline
#214
No change  Initial JS 0B 0B
No change  Initial CSS 0B 0B
Change  Cache Invalidation 0% 26.3%
No change  Chunks 0 0
No change  Assets 4 4
Change  Modules 80(+1.27%) 79
No change  Duplicate Modules 23 23
Change  Duplicate Code 40.29%(-0.02%) 40.3%
No change  Packages 2 2
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#215
     Baseline
#214
No change  IMG 145.76KiB 145.76KiB
No change  Other 52.26KiB 52.26KiB

Bundle analysis reportBranch Yradex:wt/remove-invalid-mtf-war...Project dashboard


Generated by RelativeCIDocumentationReport issue

@relativeci
Copy link
Copy Markdown

relativeci Bot commented May 9, 2026

Web Explorer

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

041d9af(current) vs 60a345b main#9521(baseline)

Bundle metrics  Change 1 change
                 Current
#9522
     Baseline
#9521
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 229(-0.43%) 230
No change  Duplicate Modules 11 11
No change  Duplicate Code 27.28% 27.28%
No change  Packages 10 10
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#9522
     Baseline
#9521
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/remove-invalid-mtf-war...Project dashboard


Generated by RelativeCIDocumentationReport issue

@relativeci
Copy link
Copy Markdown

relativeci Bot commented May 9, 2026

React MTF Example

#1080 Bundle Size — 206.6KiB (-0.04%).

041d9af(current) vs 60a345b main#1078(baseline)

Bundle metrics  Change 1 change
                 Current
#1080
     Baseline
#1078
No change  Initial JS 0B 0B
No change  Initial CSS 0B 0B
Change  Cache Invalidation 46.18% 0%
No change  Chunks 0 0
No change  Assets 3 3
No change  Modules 192 192
No change  Duplicate Modules 77 77
No change  Duplicate Code 44.36% 44.36%
No change  Packages 2 2
No change  Duplicate Packages 0 0
Bundle size by type  Change 1 change Improvement 1 improvement
                 Current
#1080
     Baseline
#1078
No change  IMG 111.23KiB 111.23KiB
Improvement  Other 95.37KiB (-0.09%) 95.46KiB

Bundle analysis reportBranch Yradex:wt/remove-invalid-mtf-war...Project dashboard


Generated by RelativeCIDocumentationReport issue

@Yradex Yradex marked this pull request as ready for review May 9, 2026 05:22
@Yradex Yradex requested review from HuJean and hzy as code owners May 9, 2026 05:22
@Yradex Yradex enabled auto-merge (squash) May 9, 2026 05:24
@Yradex Yradex merged commit 19092e5 into lynx-family:main May 9, 2026
108 of 117 checks passed
@Yradex Yradex deleted the wt/remove-invalid-mtf-warn-20260509 branch May 9, 2026 06:29
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.

2 participants