Skip to content

Commit

Permalink
Avoid calling forceUpdate when component is unmounted
Browse files Browse the repository at this point in the history
  • Loading branch information
jcreighton authored Feb 9, 2021
2 parents a7da1c7 + 3683673 commit 4b9a521
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

### Improvements

- Avoid calling `forceUpdate` when component is unmounted. <br/>
[@DylanVann](https://github.com/DylanVann) in [#7655](https://github.com/apollographql/apollo-client/pull/7655)

- The `codemods/` top-level directory has been moved into the `scripts/` directory. <br/>
[@benjamn](https://github.com/benjamn) in [#7675](https://github.com/apollographql/apollo-client/pull/7675)

Expand Down
2 changes: 1 addition & 1 deletion src/react/hooks/utils/useBaseQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export function useBaseQuery<TData = any, TVariables = OperationVariables>(
options: updatedOptions as QueryDataOptions<TData, TVariables>,
context,
onNewData() {
if (!queryData.ssrInitiated()) {
if (!queryData.ssrInitiated() && queryDataRef.current) {
// When new data is received from the `QueryData` object, we want to
// force a re-render to make sure the new data is displayed. We can't
// force that re-render if we're already rendering however so to be
Expand Down

0 comments on commit 4b9a521

Please sign in to comment.