-
Notifications
You must be signed in to change notification settings - Fork 111
fix(react/runtime): remove useless function calls #1752
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🦋 Changeset detectedLatest commit: 91ce14c The changes in this PR will be included in the next version bump. This PR includes changesets to release 0 packagesWhen 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 |
📝 WalkthroughWalkthroughRemoves the main-thread call to destroyWorklet during reload and gates an initialization patch inside destroyWorklet behind a BACKGROUND check. Adds a new empty changeset metadata file. No public API or type signatures changed. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
✨ Finishing touches
🧪 Generate unit tests
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Please see the documentation for more information. Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).Please share your feedback with us on this Discord post. 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 Pre-merge checks❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
packages/react/runtime/src/worklet/destroy.ts (2)
14-17: Make teardown resilient: run all tasks even if one throws and clear queue up-front.Pre-clearing and per-task try/catch avoids partial teardown and ensures the queue is emptied even on errors.
Apply:
- for (const task of destroyTasks) { - task(); - } - destroyTasks.length = 0; + // Empty the queue first; new tasks scheduled during teardown run on a future cycle. + const tasks = destroyTasks.splice(0); + for (const task of tasks) { + try { + task(); + } catch { + // Best-effort teardown: swallow to continue destroying remaining tasks. + // Hook up logging here if desired. + } + }
10-12: Main-thread commit already flushes init patches; add clarifying commentpackages/react/runtime/src/lifecycle/patch/commit.ts calls takeWorkletRefInitValuePatch() (around line 142) and workletRefPool clears the patch (packages/react/runtime/src/worklet/workletRefPool.ts:25–27), so main-thread reloads won't accumulate stale init patches. Keep the background-only gating in destroy.ts but add the one-line comment to document intent.
export function destroyWorklet(): void { - if (__BACKGROUND__) { + // Background-only: flushing init-value patch is safe/needed only during background reloads. + if (__BACKGROUND__) { takeWorkletRefInitValuePatch(); }
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
.changeset/every-tools-reply.md(1 hunks)packages/react/runtime/src/lifecycle/reload.ts(0 hunks)packages/react/runtime/src/worklet/destroy.ts(1 hunks)
💤 Files with no reviewable changes (1)
- packages/react/runtime/src/lifecycle/reload.ts
🧰 Additional context used
📓 Path-based instructions (1)
.changeset/*.md
📄 CodeRabbit inference engine (AGENTS.md)
For contributions, always generate a changeset and commit the resulting markdown file(s)
Files:
.changeset/every-tools-reply.md
🧠 Learnings (1)
📚 Learning: 2025-09-12T09:43:04.810Z
Learnt from: gaoachao
PR: lynx-family/lynx-stack#1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.810Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.
Applied to files:
.changeset/every-tools-reply.md
🧬 Code graph analysis (1)
packages/react/runtime/src/worklet/destroy.ts (1)
packages/react/runtime/src/worklet/workletRefPool.ts (1)
takeWorkletRefInitValuePatch(25-29)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: build / Build (Windows)
- GitHub Check: build / Build (Ubuntu)
- GitHub Check: test-rust / Test (Ubuntu)
🔇 Additional comments (1)
.changeset/every-tools-reply.md (1)
1-3: Empty changeset matches repo convention; keep as-is.Using retrieved learnings: this
---/blank/---changeset is the accepted pattern here for internalsrc/**tweaks with no user-facing notes. Looks good.Please confirm CI passes the changeset check on this PR.
Web Explorer#5222 Bundle Size — 364.39KiB (0%).91ce14c(current) vs 1a720e0 main#5220(baseline) Bundle metrics
Bundle size by type
|
| Current #5222 |
Baseline #5220 |
|
|---|---|---|
238.48KiB |
238.48KiB |
|
94.02KiB |
94.02KiB |
|
31.89KiB |
31.89KiB |
Bundle analysis report Branch Yradex:fix/mtf-reload3 Project dashboard
Generated by RelativeCI Documentation Report issue
React Example#5229 Bundle Size — 238.76KiB (-0.06%).91ce14c(current) vs 1a720e0 main#5227(baseline) Bundle metrics
Bundle size by type
Bundle analysis report Branch Yradex:fix/mtf-reload3 Project dashboard Generated by RelativeCI Documentation Report issue |
CodSpeed Performance ReportMerging #1752 will degrade performances by 11.92%Comparing Summary
Benchmarks breakdown
|
Summary by CodeRabbit
Bug Fixes
Chores
Checklist