Skip to content

fix(react): forward throttleMs from useQuery to the watched query - #1084

Open
icole wants to merge 2 commits into
powersync-ja:mainfrom
icole:fix/react-forward-throttlems-in-usequery
Open

fix(react): forward throttleMs from useQuery to the watched query#1084
icole wants to merge 2 commits into
powersync-ja:mainfrom
icole:fix/react-forward-throttlems-in-usequery

Conversation

@icole

@icole icole commented Aug 24, 2026

Copy link
Copy Markdown

Fixes #1082.

useQuery accepts throttleMs in its options type, but the object it builds for useWatchedQuery only carries reportFetching and rowComparator, so the value never arrives and you always get the 30ms default.

useWatchedQuery already reads hookOptions.throttleMs in three places, so it's just the one missing property.

The other thing I mentioned in the issue is left alone here: tables and triggerImmediate also type-check on the hook and are also dropped, and triggerOnTables isn't reachable through it at all. That's the options type inheriting from the callback API rather than the watched-query one, and untangling it is a breaking change, so it seemed like your call rather than something to fold in.

useQuery accepts throttleMs in its options type but the object it builds
for useWatchedQuery only carries reportFetching and rowComparator, so the
value never arrives and the default 30ms throttle always applies.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Aug 24, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 6ecd531

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@powersync/react Patch
@powersync/react-native Patch
@powersync/tanstack-react-query Patch
@powersync/diagnostics-app Patch

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

Covers both branches of useWatchedQuery: the standard `watch` path and the
`differentialWatch` path taken when a rowComparator is supplied. Both spy on
the watched query construction and assert the option arrives, rather than
timing throttle windows, which would be flaky on CI.

Verified to fail without the one-line fix in useQuery.ts (all four matrix
cases report `expected undefined to deeply equal 1234`).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

useQuery accepts throttleMs and silently discards it

1 participant