Skip to content

Conversation

@hzy
Copy link
Collaborator

@hzy hzy commented Jul 29, 2025

Reverts #1349

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.

Copilot AI review requested due to automatic review settings July 29, 2025 15:15
@changeset-bot
Copy link

changeset-bot bot commented Jul 29, 2025

⚠️ No Changeset found

Latest commit: 506f3ce

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 29, 2025

📝 Walkthrough

Walkthrough

This change updates the options[DIFF] hook signature across several runtime files and the related type declaration, reducing its parameters from two (vnode, oldVNode) to one (vnode). The dependency on preact in package.json is also updated to a new version. No other logic or exported API changes are introduced.

Changes

Cohort / File(s) Change Summary
Dependency Update
packages/react/package.json
Updated preact dependency version from 10.24.0-3d3cc198 to 10.24.0-319c684e.
Debug/Profiling Hooks
packages/react/runtime/src/debug/component-stack.ts,
packages/react/runtime/src/debug/profile.ts
Changed options[DIFF] hook signature from (vnode, oldVNode) to (vnode) and updated internal calls.
Lynx Runtime Hooks
packages/react/runtime/src/lynx/performance.ts,
packages/react/runtime/src/lynx/runWithForce.ts
Updated override of options[DIFF] hook to accept only vnode parameter and updated calls accordingly.
Type Declarations
packages/react/runtime/types/internal-preact.d.ts
Changed Options.__b method signature from two parameters to one: (vnode: VNode).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes

Possibly related PRs

  • chore: upgrade preact #1349: Changes the options[DIFF] hook signature in the opposite direction (from one to two parameters), making it directly related at the code level.

Suggested labels

framework:React

Suggested reviewers

  • colinaaa

Poem

A rabbit hops through code so neat,
One hook, not two, now takes the seat.
With vnode solo on the stage,
The diffing dance is all the rage!
Dependencies fresh, types align—
Reviewing this will suit you fine.
🐇✨

Note

⚡️ Unit Test Generation is now available in beta!

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


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 92445ad and 506f3ce.

⛔ 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 (5)
📓 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#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/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/lynx/performance.ts (1)
packages/react/runtime/src/renderToOpcodes/constants.ts (1)
  • DIFF (4-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/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)
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)
🔇 Additional comments (8)
packages/react/runtime/types/internal-preact.d.ts (1)

9-9: LGTM: Type definition correctly updated to match runtime signature.

The __b method signature change from two parameters to one parameter aligns with the corresponding changes in the runtime files and maintains type consistency across the codebase.

packages/react/package.json (1)

177-177: LGTM: Dependency version correctly reverted.

The Preact dependency version change from 10.24.0-3d3cc198 to 10.24.0-319c684e is consistent with the revert operation and aligns with the hook signature changes throughout the codebase.

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

150-155: LGTM: Hook signature consistently reverted to single parameter.

The options[DIFF] hook signature change from two parameters to one parameter is consistent with the revert operation. The corresponding update to the oldDiff call (line 154) correctly passes only the vnode argument, maintaining the hook's functionality while aligning with the reverted Preact version.

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

120-132: LGTM: Performance hook correctly updated for signature change.

The options[DIFF] hook signature change from two parameters to one parameter (line 120) and the corresponding oldDiff call update (line 131) are consistent with the revert operation. The performance timing logic remains intact and will continue to function correctly with the reverted Preact version.

packages/react/runtime/src/lynx/runWithForce.ts (2)

19-22: LGTM: Force rendering hook correctly updated for signature change.

The options[DIFF] hook signature change from two parameters to one parameter (line 19) and the corresponding oldDiff call update (line 21) are consistent with the revert operation. The force rendering logic remains intact and will continue to function correctly with the reverted Preact version.


64-65: LGTM: Cleanup code correctly maintains single parameter signature.

The finally block correctly restores the hook functions with the single parameter signature, maintaining consistency with the reverted Preact version.

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

12-12: LGTM: Function signature correctly updated for API revert.

The options[DIFF] hook signature has been properly updated to accept only the vnode parameter, removing the oldVNode parameter. This change aligns with the revert of the Preact upgrade and maintains proper TypeScript typing.


18-18: LGTM: Function call updated to match new signature.

The call to oldDiff has been correctly updated to pass only the vnode argument, maintaining consistency with the updated hook signature. The profiling logic remains intact and functional.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch revert-1349-p/hzy/pick_preact_4849

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 reverts a previous upgrade to the preact library by downgrading from version 10.24.0-3d3cc198 to 10.24.0-319c684e and updating all corresponding function signatures to match the older API.

  • Reverts preact package version in package.json
  • Updates all DIFF hook function signatures to remove the oldVNode parameter
  • Maintains consistent API usage across all files that utilize the preact DIFF option

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 Downgrades preact dependency version
packages/react/runtime/src/lynx/runWithForce.ts Removes oldVNode parameter from DIFF hook signature
packages/react/runtime/src/lynx/performance.ts Updates DIFF hook to single parameter signature
packages/react/runtime/src/debug/profile.ts Removes oldVNode parameter from DIFF hook function
packages/react/runtime/src/debug/component-stack.ts Updates DIFF hook to match older API signature
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

@hzy hzy enabled auto-merge July 29, 2025 15:24
@codecov
Copy link

codecov bot commented Jul 29, 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 29, 2025

CodSpeed Performance Report

Merging #1373 will not alter performance

Comparing revert-1349-p/hzy/pick_preact_4849 (506f3ce) with main (92445ad)

Summary

✅ 10 untouched benchmarks

@hzy hzy disabled auto-merge July 29, 2025 16:04
@relativeci
Copy link

relativeci bot commented Jul 29, 2025

Web Explorer

#3430 Bundle Size — 352.53KiB (0%).

506f3ce(current) vs 92445ad main#3426(baseline)

Bundle metrics  no changes
                 Current
#3430
     Baseline
#3426
No change  Initial JS 142.12KiB 142.12KiB
No change  Initial CSS 31.83KiB 31.83KiB
No change  Cache Invalidation 0% 0%
No change  Chunks 7 7
No change  Assets 7 7
No change  Modules 214 214
No change  Duplicate Modules 17 17
No change  Duplicate Code 3.94% 3.94%
No change  Packages 4 4
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#3430
     Baseline
#3426
No change  JS 226.4KiB 226.4KiB
No change  Other 94.29KiB 94.29KiB
No change  CSS 31.83KiB 31.83KiB

Bundle analysis reportBranch revert-1349-p/hzy/pick_preact_48...Project dashboard


Generated by RelativeCIDocumentationReport issue

@relativeci
Copy link

relativeci bot commented Jul 29, 2025

React Example

#3440 Bundle Size — 235.13KiB (-0.02%).

506f3ce(current) vs 92445ad main#3436(baseline)

Bundle metrics  Change 1 change
                 Current
#3440
     Baseline
#3436
No change  Initial JS 0B 0B
No change  Initial CSS 0B 0B
Change  Cache Invalidation 38.02% 0%
No change  Chunks 0 0
No change  Assets 4 4
No change  Modules 156 156
No change  Duplicate Modules 63 63
No change  Duplicate Code 45.94% 45.94%
No change  Packages 2 2
No change  Duplicate Packages 0 0
Bundle size by type  Change 1 change Improvement 1 improvement
                 Current
#3440
     Baseline
#3436
No change  IMG 145.76KiB 145.76KiB
Improvement  Other 89.38KiB (-0.05%) 89.42KiB

Bundle analysis reportBranch revert-1349-p/hzy/pick_preact_48...Project dashboard


Generated by RelativeCIDocumentationReport issue

@colinaaa colinaaa added this pull request to the merge queue Jul 30, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Jul 30, 2025
@colinaaa colinaaa added this pull request to the merge queue Jul 30, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jul 30, 2025
@hzy hzy added this pull request to the merge queue Jul 30, 2025
Merged via the queue into main with commit 1cf2bed Jul 30, 2025
48 of 51 checks passed
@hzy hzy deleted the revert-1349-p/hzy/pick_preact_4849 branch July 30, 2025 10:23
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.

3 participants