Closed TheRealNate closed 3 years ago
This update is a bit more complex than #4. Have you thought about how to best handle this already?
For the short-term, could we just use the UNSAFE_componentWillUpdate()
which is scheduled to last through 17.0+? This should suppress the warning.
Longer term, looking at componentDidUpdate()
may work with corrections for arguments that are backwards looking (prevProps
, prevState
) vs the current forward looking (nextProps
, nextState
)
@PolarisWT I have merged your PR for renaming to UNSAFE_.
Definitely a tricky update. The author states:
Temporarily assign this.state and this.props, so that they are seen by getMeteorData!
This is a simulation of how the proposed Observe API for React will work, which calls observe() after componentWillUpdate and after props and state are updated, but before render() is called. See https://github.com/facebook/react/issues/3398.
So it seems that this._meteorDataManager.calculateData
needs to be run with new props and state but before render. componentDidUpdate
is run after render.
The suspense API may be a solution (it's mentioned in the "Observe" proposal"), but technically isn't ready for stable release yet...
Closing this issue due to no activity. Feel free to reopen.
This has been fixed in 2.1.0
UNSAFE_componentWillUpdate
is a legacy method/src/components/ReactMeteorData.js#L19