Skip to content

fix: (react) explicitly overwrite error variable in state#3860

Merged
JoviDeCroock merged 4 commits intourql-graphql:mainfrom
BelgianNoise:fix/explicitly-overwrite-error-variable-in-react-state
Apr 2, 2026
Merged

fix: (react) explicitly overwrite error variable in state#3860
JoviDeCroock merged 4 commits intourql-graphql:mainfrom
BelgianNoise:fix/explicitly-overwrite-error-variable-in-react-state

Conversation

@BelgianNoise
Copy link
Copy Markdown
Contributor

Issue

The error variable on the internal state would not clear once the query was refetched and did not receive any errors -> once an error occured, it would live in the useSuery state until it was overwritten by another error, but error would be defined indefinitely.

Summary

This pull request introduces a small update to the computeNextState function in state.ts. The change ensures that the error property from the result is now explicitly included in the computed next state object.

Set of changes

  • set the error variable explicitly on the next state

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 1, 2026

🦋 Changeset detected

Latest commit: ef2b9b3

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

This PR includes changesets to release 1 package
Name Type
urql 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

@BelgianNoise
Copy link
Copy Markdown
Contributor Author

⚠️ No Changeset found

Latest commit: 189d46f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

What's convention here, I don't require an immediate release/bump, but ofc rather sooner than later.

@BelgianNoise BelgianNoise marked this pull request as ready for review April 1, 2026 14:47
@JoviDeCroock
Copy link
Copy Markdown
Collaborator

JoviDeCroock commented Apr 1, 2026

https://github.com/urql-graphql/urql/blob/main/CONTRIBUTING.md

Also getting ahead of this, would love to see a test for what this is solving. Preventing future regressions and all

@BelgianNoise
Copy link
Copy Markdown
Contributor Author

BelgianNoise commented Apr 1, 2026

main/CONTRIBUTING.md

Will do, the changeset-bot made it sound like an optional thing, that's why I wanted to double check.

Edit: I also didn't mean to mark the PR as ready for review yet, mb.

@BelgianNoise BelgianNoise marked this pull request as draft April 1, 2026 22:18
@BelgianNoise BelgianNoise marked this pull request as ready for review April 1, 2026 22:28
@JoviDeCroock JoviDeCroock merged commit 887cb2a into urql-graphql:main Apr 2, 2026
12 checks passed
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