Skip to content

Conversation

@hzy
Copy link
Collaborator

@hzy hzy commented Jul 24, 2025

To compare: preactjs/preact@10.24.0...hzy:preact:lynx/v10.24.x, which means this is preactjs/preact#4849 landed on previous version 319c684e

Summary by CodeRabbit

  • Bug Fixes

    • Improved internal handling of rendering lifecycle hooks for better consistency and compatibility.
  • Chores

    • Updated a dependency to a newer version for enhanced stability.

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

To compare: preactjs/preact@10.24.0...hzy:preact:lynx/v10.24.x, which means this is preactjs/preact#4849 landed on previous version `319c684e`
Copilot AI review requested due to automatic review settings July 24, 2025 13:22
@changeset-bot
Copy link

changeset-bot bot commented Jul 24, 2025

⚠️ No Changeset found

Latest commit: e9e954a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 24, 2025

📝 Walkthrough

Walkthrough

The changes update the signature of the options[DIFF] (or __b) hook throughout the codebase to accept two parameters, vnode and oldVNode, instead of just vnode. This affects several runtime and type definition files, as well as the preact dependency version in the package manifest.

Changes

Files Change Summary
packages/react/package.json Updated "preact" dependency version.
packages/react/runtime/src/debug/component-stack.ts
packages/react/runtime/src/debug/profile.ts
packages/react/runtime/src/lynx/performance.ts
packages/react/runtime/src/lynx/runWithForce.ts
Updated options[DIFF] hook signature and invocation to accept (vnode, oldVNode) instead of just vnode.
packages/react/runtime/types/internal-preact.d.ts Updated Options.__b type signature to (vnode: VNode, oldVNode: VNode).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes

Suggested labels

framework:React

Poem

A bunny hopped through fields of code,
Adjusting hooks where diffs are showed.
Two arguments now, not just one—
Old and new, the change is done!
With every hop, the types align,
The stack and profile both refine.
🐇✨ Code harmony, by design!

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

 ERROR  Cannot resolve version $@rspack/core in overrides. The direct dependencies don't have dependency "@rspack/core".
For help, run: pnpm help install

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR upgrades the preact dependency from version 10.24.0-319c684e to 10.24.0-3d3cc198 and updates the codebase to accommodate API changes in the new version. The upgrade includes handling a new parameter in the options[DIFF] hook callback.

  • Updates preact dependency version in package.json
  • Modifies all options[DIFF] hook implementations to accept the new oldVNode parameter
  • Ensures backward compatibility by passing the additional parameter to existing diff callbacks

Reviewed Changes

Copilot reviewed 5 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/react/package.json Updates preact dependency version
packages/react/runtime/src/lynx/runWithForce.ts Adds oldVNode parameter to DIFF hook callback
packages/react/runtime/src/lynx/performance.ts Adds oldVNode parameter to DIFF hook callback
packages/react/runtime/src/debug/profile.ts Adds oldVNode parameter to DIFF hook callback
packages/react/runtime/src/debug/component-stack.ts Adds oldVNode parameter to DIFF hook callback
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (1)

packages/react/runtime/src/lynx/runWithForce.ts:19

  • The parameter 'oldVNode' lacks a type annotation. It should be typed consistently with other similar parameters in the codebase.
  options[DIFF] = (vnode: PatchedVNode, oldVNode) => {

Copy link
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

🧹 Nitpick comments (1)
packages/react/runtime/src/lynx/runWithForce.ts (1)

19-19: Add explicit typing for the oldVNode parameter.

The oldVNode parameter should be explicitly typed for better type safety and consistency with the codebase.

-  options[DIFF] = (vnode: PatchedVNode, oldVNode) => {
+  options[DIFF] = (vnode: PatchedVNode, oldVNode: VNode | null) => {
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d279480 and e9e954a.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (6)
  • packages/react/package.json (1 hunks)
  • packages/react/runtime/src/debug/component-stack.ts (1 hunks)
  • packages/react/runtime/src/debug/profile.ts (1 hunks)
  • packages/react/runtime/src/lynx/performance.ts (2 hunks)
  • packages/react/runtime/src/lynx/runWithForce.ts (1 hunks)
  • packages/react/runtime/types/internal-preact.d.ts (1 hunks)
🧰 Additional context used
🧠 Learnings (6)
📓 Common learnings
Learnt from: colinaaa
PR: lynx-family/lynx-stack#1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:23:07.797Z
Learning: In the lynx-family/lynx-stack repository, changesets are only required for meaningful changes to end-users such as bugfixes and features. Internal/development changes like chores, refactoring, or removing debug info do not need changeset entries.
Learnt from: colinaaa
PR: lynx-family/lynx-stack#1238
File: packages/react/runtime/src/debug/component-stack.ts:70-90
Timestamp: 2025-07-18T04:27:18.291Z
Learning: The component-stack.ts file in packages/react/runtime/src/debug/component-stack.ts is a direct fork from https://github.com/preactjs/preact/blob/main/debug/src/component-stack.js. The team prefers to keep it aligned with the upstream Preact version and may contribute improvements back to Preact in the future.
Learnt from: colinaaa
PR: lynx-family/lynx-stack#1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:26:16.722Z
Learning: In the lynx-family/lynx-stack repository, CI checks require changesets when files matching the pattern "src/**" are modified (as configured in .changeset/config.json). For internal changes that don't need meaningful changesets, an empty changeset file is used to satisfy the CI requirement while not generating any release notes.
packages/react/package.json (1)

Learnt from: colinaaa
PR: #1238
File: packages/react/runtime/src/debug/component-stack.ts:70-90
Timestamp: 2025-07-18T04:27:18.291Z
Learning: The component-stack.ts file in packages/react/runtime/src/debug/component-stack.ts is a direct fork from https://github.com/preactjs/preact/blob/main/debug/src/component-stack.js. The team prefers to keep it aligned with the upstream Preact version and may contribute improvements back to Preact in the future.

packages/react/runtime/src/debug/component-stack.ts (1)

Learnt from: colinaaa
PR: #1238
File: packages/react/runtime/src/debug/component-stack.ts:70-90
Timestamp: 2025-07-18T04:27:18.291Z
Learning: The component-stack.ts file in packages/react/runtime/src/debug/component-stack.ts is a direct fork from https://github.com/preactjs/preact/blob/main/debug/src/component-stack.js. The team prefers to keep it aligned with the upstream Preact version and may contribute improvements back to Preact in the future.

packages/react/runtime/src/lynx/performance.ts (1)

Learnt from: colinaaa
PR: #1238
File: packages/react/runtime/src/debug/component-stack.ts:70-90
Timestamp: 2025-07-18T04:27:18.291Z
Learning: The component-stack.ts file in packages/react/runtime/src/debug/component-stack.ts is a direct fork from https://github.com/preactjs/preact/blob/main/debug/src/component-stack.js. The team prefers to keep it aligned with the upstream Preact version and may contribute improvements back to Preact in the future.

packages/react/runtime/types/internal-preact.d.ts (1)

Learnt from: colinaaa
PR: #1238
File: packages/react/runtime/src/debug/component-stack.ts:70-90
Timestamp: 2025-07-18T04:27:18.291Z
Learning: The component-stack.ts file in packages/react/runtime/src/debug/component-stack.ts is a direct fork from https://github.com/preactjs/preact/blob/main/debug/src/component-stack.js. The team prefers to keep it aligned with the upstream Preact version and may contribute improvements back to Preact in the future.

packages/react/runtime/src/debug/profile.ts (1)

Learnt from: colinaaa
PR: #1238
File: packages/react/runtime/src/debug/component-stack.ts:70-90
Timestamp: 2025-07-18T04:27:18.291Z
Learning: The component-stack.ts file in packages/react/runtime/src/debug/component-stack.ts is a direct fork from https://github.com/preactjs/preact/blob/main/debug/src/component-stack.js. The team prefers to keep it aligned with the upstream Preact version and may contribute improvements back to Preact in the future.

🧬 Code Graph Analysis (4)
packages/react/runtime/src/debug/component-stack.ts (1)
packages/react/runtime/src/renderToOpcodes/constants.ts (1)
  • DIFF (4-4)
packages/react/runtime/src/lynx/performance.ts (1)
packages/react/runtime/src/renderToOpcodes/constants.ts (1)
  • DIFF (4-4)
packages/react/runtime/src/debug/profile.ts (2)
packages/react/runtime/src/renderToOpcodes/constants.ts (1)
  • DIFF (4-4)
packages/react/runtime/src/utils.ts (1)
  • getDisplayName (67-69)
packages/react/runtime/src/lynx/runWithForce.ts (2)
packages/react/runtime/__test__/utils/nativeMethod.ts (1)
  • options (23-23)
packages/react/runtime/src/renderToOpcodes/constants.ts (1)
  • DIFF (4-4)
🔇 Additional comments (5)
packages/react/package.json (1)

169-169: LGTM! Dependency version aligns with the DIFF hook signature changes.

The preact dependency update from 10.24.0-319c684e to 10.24.0-3d3cc198 correctly supports the two-parameter options[DIFF] hook signature changes implemented throughout the runtime files.

packages/react/runtime/src/lynx/performance.ts (1)

120-132: LGTM! Correctly implements the two-parameter DIFF hook signature.

The changes properly update the options[DIFF] hook to accept both vnode and oldVNode parameters and pass them through to the original oldDiff function. The timing logic remains intact.

packages/react/runtime/types/internal-preact.d.ts (1)

9-9: LGTM! Type definition correctly reflects the updated DIFF hook signature.

The __b hook type signature properly updated to accept both vnode and oldVNode parameters, maintaining type consistency with the runtime implementation changes.

packages/react/runtime/src/debug/profile.ts (1)

12-19: LGTM! Profile hook correctly updated for the new DIFF signature.

The changes properly implement the two-parameter DIFF hook signature while preserving the existing profiling logic for function components.

packages/react/runtime/src/debug/component-stack.ts (1)

150-155: LGTM! Component stack hook correctly updated to match upstream Preact.

The DIFF hook signature update maintains the component stack tracking logic while properly implementing the two-parameter signature. This aligns well with the team's preference to keep this forked file consistent with upstream Preact changes.

@codecov
Copy link

codecov bot commented Jul 24, 2025

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

codspeed-hq bot commented Jul 24, 2025

CodSpeed Performance Report

Merging #1349 will not alter performance

Comparing hzy:p/hzy/pick_preact_4849 (e9e954a) with main (d279480)

Summary

✅ 10 untouched benchmarks

@relativeci
Copy link

relativeci bot commented Jul 24, 2025

Web Explorer

#3328 Bundle Size — 304.83KiB (~+0.01%).

e9e954a(current) vs 2be5349 main#3322(baseline)

Bundle metrics  Change 2 changes
                 Current
#3328
     Baseline
#3322
No change  Initial JS 140.95KiB 140.95KiB
No change  Initial CSS 31.83KiB 31.83KiB
No change  Cache Invalidation 23.11% 23.11%
No change  Chunks 4 4
No change  Assets 5 5
Change  Modules 204(-0.49%) 205
No change  Duplicate Modules 17 17
Change  Duplicate Code 4.23%(+0.24%) 4.22%
No change  Packages 3 3
No change  Duplicate Packages 0 0
Bundle size by type  Change 2 changes Regression 1 regression Improvement 1 improvement
                 Current
#3328
     Baseline
#3322
Regression  JS 222.18KiB (~+0.01%) 222.17KiB
Improvement  Other 50.82KiB (~-0.01%) 50.82KiB
No change  CSS 31.83KiB 31.83KiB

Bundle analysis reportBranch hzy:p/hzy/pick_preact_4849Project dashboard


Generated by RelativeCIDocumentationReport issue

@relativeci
Copy link

relativeci bot commented Jul 24, 2025

React Example

#3338 Bundle Size — 235.02KiB (+0.02%).

e9e954a(current) vs 2be5349 main#3332(baseline)

Bundle metrics  Change 2 changes
                 Current
#3338
     Baseline
#3332
No change  Initial JS 0B 0B
No change  Initial CSS 0B 0B
Change  Cache Invalidation 37.97% 0%
No change  Chunks 0 0
No change  Assets 4 4
No change  Modules 156 156
No change  Duplicate Modules 63 63
Change  Duplicate Code 45.96%(+0.02%) 45.95%
No change  Packages 2 2
No change  Duplicate Packages 0 0
Bundle size by type  Change 1 change Regression 1 regression
                 Current
#3338
     Baseline
#3332
No change  IMG 145.76KiB 145.76KiB
Regression  Other 89.26KiB (+0.05%) 89.22KiB

Bundle analysis reportBranch hzy:p/hzy/pick_preact_4849Project dashboard


Generated by RelativeCIDocumentationReport issue

@colinaaa colinaaa added this pull request to the merge queue Jul 24, 2025
Merged via the queue into lynx-family:main with commit 9bb1dda Jul 24, 2025
65 of 70 checks passed
hzy added a commit that referenced this pull request Jul 29, 2025
github-merge-queue bot pushed a commit that referenced this pull request Jul 30, 2025
Reverts #1349

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Refactor**
* Updated the signature of an internal rendering hook to accept a single
parameter for improved consistency.
* Adjusted related profiling and performance logic to align with the new
hook signature.
* **Chores**
  * Updated the "preact" dependency version.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This was referenced Jul 31, 2025
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