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

Commit 63f8a19

Browse files
committed
Avoid React 16.13.0 update during render warning
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.
1 parent 142fe1c commit 63f8a19

File tree

12 files changed

+250
-249
lines changed

12 files changed

+250
-249
lines changed

Changelog.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Change log
22

3+
## 3.1.5 (2020-04-14)
4+
5+
- 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/>
6+
[@hwillson](https://github.com/hwillson) in [#3930](https://github.com/apollographql/react-apollo/pull/3930)
7+
38
## 3.1.4 (2020-04-03)
49

510
- 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/>
@@ -1181,7 +1186,7 @@ import { getDataFromTree, renderToStringWithData } from 'react-apollo';
11811186
renderToStringWithData(component).then({ markup, initialState });
11821187

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

11871192
// ...

0 commit comments

Comments
 (0)