Skip to content

Conversation

Chriztiaan
Copy link
Contributor

@Chriztiaan Chriztiaan commented Sep 2, 2025

The useWatchedQuery's useEffect responsible for updating the watchedQuery's settings on query change never triggered in React.StrictMode.

Basically the queryChanged prop changes from false => true => false before the useEffect would pick up the change. So that "query change" event was consumed without doing anything, I have introduced a ref approach to protect against this from happening.

For good measure I have opted to change the useQuery test suite to run the tests in both normal and Strict mode, if we like this pattern we can apply it to the other React package's tests.

…ution when the query or parameters changed while using StrictMode.
Copy link

changeset-bot bot commented Sep 2, 2025

🦋 Changeset detected

Latest commit: 5036ff3

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

simolus3
simolus3 previously approved these changes Sep 2, 2025
Copy link
Contributor

@simolus3 simolus3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The implementation and test changes look good to me 👍

Copy link
Collaborator

@stevensJourney stevensJourney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me :)

@Chriztiaan Chriztiaan merged commit b1aca34 into main Sep 3, 2025
9 of 11 checks passed
@Chriztiaan Chriztiaan deleted the fix/strict-mode-use-query branch September 3, 2025 06:56
whygee-dev pushed a commit to whygee-dev/powersync-js that referenced this pull request Oct 18, 2025
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.

3 participants