Skip to content

fix: one-level method calls in inferred hook dependencies - #552

Merged
leonidaz merged 1 commit into
mainfrom
deps
Aug 3, 2026
Merged

leonidaz merged 1 commit into
mainfrom
deps

Conversation

@leonidaz

@leonidaz leonidaz commented Aug 3, 2026 •

Copy link
Copy Markdown
Collaborator

addresses the first issue in #542


Note

Medium Risk
Changes compiler-inferred dependency shapes for all one-level method calls in hooks, affecting memo/effect re-run semantics; scope is narrow and covered by new tests, but any app relying on the old (buggy) prototype-method behavior will see different updates.

Overview
Address the first part of #542: inferred dependency arrays no longer use the method function alone for one-level calls like count.toFixed(2) or props.onChange(...), which broke memos when the callee was a shared prototype method.

The compiler now emits __methodDep(root, 'name') in inferred arrays. At runtime the helper compares the own property when the method lives on the object, the receiver when it is inherited (e.g. Number.prototype.toFixed), and undefined when an optional handler is missing—so props.onReady?.() does not re-run every render. Deeper (a.b.c(...)) and computed callees are unchanged.

Wiring spans hook-deps.js (detection + AST), client/server compile.js and slot-hooks.js (imports), new method-dep.ts, and docs in differences-from-react.md, with behavioral and compiler tests.

Reviewed by Cursor Bugbot for commit 37be5d0. Bugbot is set up for automated code reviews on this repo. Configure here.

@vercel

vercel Bot commented Aug 3, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
octane-website Ready Ready Preview Aug 3, 2026 8:28pm
octane-website-mcp Ready Ready Preview Aug 3, 2026 8:28pm

Request Review

@github-actions github-actions Bot added the fix PR: bug fix label Aug 3, 2026
@vercel
vercel Bot temporarily deployed to Preview – octane-website August 3, 2026 20:28 Inactive
@leonidaz
leonidaz merged commit 29c5bdb into main Aug 3, 2026
38 checks passed
@leonidaz
leonidaz deleted the deps branch August 3, 2026 20:44

This branch was previously deployed

2 inactive deployments
Preview – octane-website — 37be5d0d Deployed Aug 3, 2026 by vercel[bot]
Preview – octane-website-mcp — 37be5d0d Deployed Aug 3, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix PR: bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant