Skip to content

Conversation

Chriztiaan
Copy link
Contributor

This fixes a reported issue where a query that is busy fetching handles a query/parameter change incorrectly. It would go from reporting isFetching=true, to false, to immediately true again. With the expected behaviour being that it remained true during the transition instead. This also caused isLoading to become false prematurely.

This was caused by the stale query handler not aborting correctly.

Example erroneous output, where the param changes from 0->1:

{param: '0', dataLength: 0, isFetching: true, isLoading: true}
{param: 1, dataLength: 0, isFetching: true, isLoading: true}
{param: 1, dataLength: 0, isFetching: false, isLoading: false} <--- we don't expect this step
{param: 1, dataLength: 0, isFetching: true, isLoading: false}
{param: 1, dataLength: 1, isFetching: false, isLoading: false}

Expected output:

{param: '0', dataLength: 0, isFetching: true, isLoading: true}
{param: 1, dataLength: 0, isFetching: true, isLoading: true}
{param: 1, dataLength: 1, isFetching: false, isLoading: false}

Added a unit test for both React and Vue packages.

…query/parameters change. This fixes the edge case where an already fetching query would handle a query change and briefly report `isFetching` being false before becoming true again.
Copy link

changeset-bot bot commented Sep 4, 2025

🦋 Changeset detected

Latest commit: 141bff8

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

This PR includes changesets to release 8 packages
Name Type
@powersync/common Patch
@powersync/adapter-sql-js Patch
@powersync/node Patch
@powersync/op-sqlite Patch
@powersync/react-native Patch
@powersync/tanstack-react-query Patch
@powersync/web 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

@Chriztiaan Chriztiaan marked this pull request as ready for review September 4, 2025 10:06
@Chriztiaan Chriztiaan changed the title fix: isFetching value brief false state when in flight query handles change fix: prevent isFetching flickering during query parameter changes Sep 4, 2025
@Chriztiaan Chriztiaan merged commit 4d532d4 into main Sep 4, 2025
9 checks passed
@Chriztiaan Chriztiaan deleted the fix/react-is-fetching branch September 4, 2025 11:00
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.

2 participants