meteorrn / meteor-react-native

Meteor client for React Native matching Meteor Spec
https://guide.meteor.com/react-native.html
Other
59 stars 31 forks source link

Remove reference to UNSAFE_componentWillUpdate #3

Closed TheRealNate closed 3 years ago

TheRealNate commented 4 years ago

UNSAFE_componentWillUpdate is a legacy method

/src/components/ReactMeteorData.js#L19

PolarisWT commented 4 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)

TheRealNate commented 4 years ago

@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...

github-actions[bot] commented 4 years ago

Closing this issue due to no activity. Feel free to reopen.

TheRealNate commented 3 years ago

This has been fixed in 2.1.0