fix: (react) explicitly overwrite error variable in state#3860
Conversation
🦋 Changeset detectedLatest commit: ef2b9b3 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
What's convention here, I don't require an immediate release/bump, but ofc rather sooner than later. |
|
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 |
|
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. |
Issue
The
errorvariable 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 theuseSuerystate until it was overwritten by another error, buterrorwould be defined indefinitely.Summary
This pull request introduces a small update to the
computeNextStatefunction instate.ts. The change ensures that theerrorproperty from the result is now explicitly included in the computed next state object.Set of changes
errorvariable explicitly on the next state