Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

Commit

Permalink
Avoid React 16.13.0 update during render warning
Browse files Browse the repository at this point in the history
As of version 16.13.0, React logs a warning when a function component
is updated during another component's render phase
(facebook/react#17099). PR #3902 addresses some of this, but doesn't
quite catch all scenarios where this can occur. These changes take
things further, ensuring that React Apollo components can't force
update during a render phase.
  • Loading branch information
hwillson committed Apr 14, 2020
1 parent 142fe1c commit 63f8a19
Show file tree
Hide file tree
Showing 12 changed files with 250 additions and 249 deletions.
7 changes: 6 additions & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Change log

## 3.1.5 (2020-04-14)

- Another pass at preventing new data re-render attempts during an existing render (the solution published with React Apollo 3.1.4 wasn't as all encompassing as it needs to be). This helps avoid React 16.13.0's "Cannot update a component from inside the function body of a different component" warning (https://github.com/facebook/react/pull/17099). <br/>
[@hwillson](https://github.com/hwillson) in [#3930](https://github.com/apollographql/react-apollo/pull/3930)

## 3.1.4 (2020-04-03)

- Prevent new data re-render attempts during an existing render. This helps avoid React 16.13.0's "Cannot update a component from inside the function body of a different component" warning (https://github.com/facebook/react/pull/17099). <br/>
Expand Down Expand Up @@ -1181,7 +1186,7 @@ import { getDataFromTree, renderToStringWithData } from 'react-apollo';
renderToStringWithData(component).then({ markup, initialState });

// new -- you must get it yourself
renderToStringWithData(component).then(markup => {
renderToStringWithData(component).then((markup) => {
const initialState = client.store.getState()[client.reduxRootKey];

// ...
Expand Down
Loading

0 comments on commit 63f8a19

Please sign in to comment.