Repository navigation
fix: recognize callback-attached refs in strong effects - #1669
Merged
trueadm merged 1 commit intoOct 3, 2026
Merged
Conversation
trueadm
marked this pull request as ready for review
October 3, 2026 15:09
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
Bugbot Autofix is ON, but it could not run because the branch was deleted or merged before autofix could start.
Reviewed by Cursor Bugbot for commit 20bc064. Configure here.
| return; | ||
| } | ||
| if (value.type === 'Identifier' && templateShadowed(value.name, ancestors)) return; | ||
| const callback = functionOf(value); |
There was a problem hiding this comment.
Shadowed callback aliases look attached
Low Severity
attachCallbacks only rejects a template-shadowed name at the ref expression itself. functionOf then follows stable aliases with bindingOf, which cannot see @for/@catch bindings, so an alias of a shadowed callback name still resolves to the outer function and can mark a value-ref as attached.
Reviewed by Cursor Bugbot for commit 20bc064. Configure here.
6 of 7 tasks
KevinVandy
pushed a commit
to KevinVandy/octane
that referenced
this pull request
Oct 9, 2026
* feat: add @octanejs/tanstack-db binding Port the Octane live-query bindings for @tanstack/db (TanStack/db PR octanejs#1699, `packages/octane-db`, still open) into the monorepo as `@octanejs/tanstack-db`. - Re-exports @tanstack/[email protected] unchanged; adapts the live-query surface (useLiveQuery, useLiveInfiniteQuery, useLiveSuspenseQuery, useLiveQueryEffect, usePacedMutations) onto Octane hooks. Source imports only public @tanstack/db. - Package shape matches sibling bindings: exports point at src/ (no dist build), self-contained tsconfig (jsxImportSource octane), status.json. - Tests decoupled from the db monorepo: internal src imports rewritten to @tanstack/db; test helpers, the conformance suite, and db's expression evaluator vendored under tests/db-fixtures/ (pinned to 0.6.17, test-only) so the infinite-query tests can interpret the where/cursor IR db generates. - Wired into vitest.config.js and the root typecheck script; registered in website/src/content/bindings.json; changeset added. Generated inventories (docs/packages.md, docs/bindings-status.md, CLI data, react-parity lockfile hashes) are intentionally omitted from this diff and should be regenerated with `pnpm sync` at merge time. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * fix(tanstack-db): move @octanejs/tanstack-db to TanStack DB 0.7.0 and fix live-query blockers Rebinds the binding to the TanStack DB 0.7.0 adapter architecture and fixes the PR review's P1 blockers at the source: - Suspense suspends via Octane `use(thenable)` instead of `throw promise` (Octane Suspense only recognizes the use() sentinel). Proven by an async fallback regression test. - useLiveQuery/useLiveSuspenseQuery rebuilt on db's shared createLiveQueryObserver (db octanejs#1642) so status-only transitions (error/cleaned-up) update isError/ isCleanedUp. - useLiveInfiniteQuery rebuilt on the coordinated createLiveQueryWindowController (db octanejs#1675): window leases stop two hooks on one collection truncating each other (regression test), and a failed page load rolls back and surfaces snapshot.error with a clean retry. - useLiveQueryEffect parses deps + the compiler slot together from ...rest, so no-deps usage keeps its call-site slot. - Conformance suite: drop order-only-move from universal expected-fail (db octanejs#1669 fixed the contract); un-skip the missing-orderBy test (surfaced synchronously during render via getWindow()); record StrictMode double-invoke as not-applicable. Committed-test-marker gate passes. - Bump @tanstack/db ^0.6.17 -> ^0.7.0; re-pin vendored db-internal fixtures; vendor the @tanstack/[email protected] adapter source under upstream/ with SHA256SUMS; add UPSTREAM.md pin + crosswalk; refresh status.json/README. Octane-adaptation: the subscribe wrappers defer an initial onStoreChange to a microtask because Octane's useSyncExternalStore re-checks the snapshot before (not after) subscribe; pinned by the eager-onstorechange test. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * fix(tanstack-db): call use() unconditionally in useLiveSuspenseQuery; document startSync divergence Addresses two Cursor Bugbot findings on the 0.7.0 remediation commit. - [High] useLiveSuspenseQuery called use() only on the loading/idle path and skipped it once ready. Octane keys use(thenable) by dynamic call-order index (runtime __thenableIdx), not by compiler slot, so a ready hook that skips its use() shifts the thenable index of a sibling use()/second useLiveSuspenseQuery in the same component. On the replay after the first query resolves, the second hook read the first's fulfilled thenable (resume-replay leniency path) and stopped suspending, surfacing its still-loading collection as ready. Fix: call use() unconditionally — exactly once per render — handing it an already-resolved sentinel on the ready/stale paths so the call-order index stays stable and no suspend occurs. New regression test drives two independently gated collections and asserts the later sibling stays suspended while the earlier one is ready (fails pre-fix with `a:3|b:0`). - [Medium] Documented the useLiveInfiniteQuery `startSync: true` divergence in status.json. The query-function collection is created with the first-page window already applied (.limit(pageSize + 1).offset(0)), so eager sync fetches exactly the first page — never a wider subset — before the window controller grows it; only the fetch-start timing differs from upstream's post-commit start. (Bugbot's third finding, "stale pages after deps change", was against the pre-remediation commit and no longer applies: the controller rewrite computes page count synchronously during render.) Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * fix(tanstack-db): pre-tag the useLiveSuspenseQuery ready-path sentinel as fulfilled Follow-up to the unconditional-use() change. The shared `SETTLED` thenable handed to `use()` on the non-loading paths was a bare `Promise.resolve()`. Octane's `use()` tags an untagged thenable `'pending'` synchronously (its fulfillment callback runs a microtask later), so the first `use(SETTLED)` on the ready path suspended and flashed the Suspense fallback even though data was already ready. Give `SETTLED` the React 19 `cache()` settled shape (`status: 'fulfilled'`) so `trackThenable` leaves it untouched and `use()` returns synchronously without suspending. New regression test preloads a collection to `ready` before mount so the first render takes the ready path, and asserts the fallback never renders (fails pre-fix: first commit shows `Loading...` instead of `ready:3`). Reported by Cursor Bugbot on the previous commit. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * fix(tanstack-db): defer infinite query sync until commit * fix: repair tanstack db CI integration * fix: complete tanstack db CI integration --------- Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]> Co-authored-by: Dominic Gannaway <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
Fix Strong diagnostics for refs attached through callbacks.
Why
A callback that stores its attached node in a ref was reported as a hidden value-ref dependency when an effect read it. The equivalent object ref is accepted.
Changes
Validation
pnpm sync.pnpm format:check,pnpm typecheck, andpnpm test: the configured registry did not provide all dependencies locally. CI should run the complete checks.Risk / follow-ups
Callback-ref inference follows direct assignments and stable aliases. Like the existing object-ref classification, it does not prove the behavior of arbitrary helper side effects.
Provenance
agent-authored)Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Note
Medium Risk
Expands static ref provenance in the Strong compiler with nuanced callback analysis; misclassification could change diagnostics without altering emitted code.
Overview
Strong mode no longer treats refs filled via callback refs as hidden “value ref” dependencies when an effect reads
ref.current, matching behavior already allowed forref={element}object refs.buildReferences()instrong-effects.jsnow walks JSXrefexpressions, analyzes callback bodies for directref.current = node(plus stable aliases, conditionals, cleanup clears, and TSRX@for/@catchshadowing), and marks those roots as attached (escaped/hostfor lowercase DOM elements). Callbacks reused as event handlers or with unsafe writes stay invalid, soHIDDENstill fires. Listener leak checks continue to apply to callback-attached host refs.Adds an octane patch changeset and a large regression suite in
strong-effects.test.ts(accept/reject matrices, TSX, client/server parity, leak + cleanup).Reviewed by Cursor Bugbot for commit 20bc064. Bugbot is set up for automated code reviews on this repo. Configure here.