Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(deprecation): 16.9.0 methods #31

Open
wants to merge 1 commit into
base: master
from

Conversation

@semoal
Copy link

commented Aug 13, 2019

Fixes: #30

Sergio
@@ -45,8 +45,9 @@ export default class OutsideClickHandler extends React.Component {
if (!disabled) this.addMouseDownEventListener(useCapture);
}

componentWillReceiveProps({ disabled, useCapture }) {
const { disabled: prevDisabled } = this.props;
componentDidUpdate(prevProps) {

This comment has been minimized.

Copy link
@ljharb

ljharb Aug 13, 2019

Collaborator

I'm not confident this is a "fix"; this will cause this logic to apply after the update, instead of before.

This comment has been minimized.

Copy link
@semoal

semoal Aug 13, 2019

Author

Hi Jordan, probably you're right but actually I couldn't find a logic that apply in a before update.

The new React API doesn't give any option for check future props (static getDerivedState..., but not correct for this case). Am i wrong ?

This comment has been minimized.

Copy link
@ljharb

ljharb Aug 13, 2019

Collaborator

I believe you are right, which means that there may not yet be a solution here.

If it turns out we can migrate to cDU, then we should have been doing that in the first place; if not, then we won't be compatible with React 17 in async mode until React adds a new API to replace what it's removing.

This comment has been minimized.

Copy link
@semoal

semoal Aug 13, 2019

Author

Okay, we could just rename UNSAFE_componentWillMount meanwhile.
Anyways, I've tried this supposed "fix", on a website we're building and looks there's nothing broken, test passed too.

This comment has been minimized.

Copy link
@ljharb

ljharb Aug 13, 2019

Collaborator

That method is only available in React 16.3+, so that's also not an option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.