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

Support React 16.9 #46

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

TheRusskiy
Copy link

Prepend UNSAFE_ to lifecycle methods

@netlify
Copy link

netlify bot commented Oct 14, 2019

Deploy preview for react-block-ui ready!

Built with commit 1ba65ef

https://deploy-preview-46--react-block-ui.netlify.com

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.9%) to 96.552% when pulling 1ba65ef on TheRusskiy:master into 84153c0 on Availity:master.

Copy link
Contributor

@GoPro16 GoPro16 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would be a breaking change because we are requiring the user be on react version 16. IIRC, v14, and v15 don't have that renamed method unless they backwards patched it. If that is the case then its safe.

Regardless, one of the tests is now failing as a result of renaming the lifecycle methods, you may want to check that out

@TheSharpieOne
Copy link
Collaborator

TheSharpieOne commented Oct 15, 2019

Yes, this doesn't add support for 16.9 as much as it drops support for for older versions of react (which are still listed in the package.json).
this library stills works 100% in 16.9 as well as newer versions of react (pretty much up to 17 when they will make the breaking change and remove these now deprecated methods).

@TheRusskiy
Copy link
Author

Hm... You are right, I haven't mentioned that it would break in React 15.
Though it's probably the right move as React 16 been there for a while.
Also, I mean no offense, but I don't think that when library outputs deprecation warnings that it's working. Deprecation warnings in developer console are not only annoying but dangerous as well since they can mask real errors and problems. Also some error reporting tools store information about all console warnings.
As for the breaking spec I started looking into it, and it seems like the whole test chain needs to be updated to support React 16. Don't quote me on that though. Need more time to look into it.

@TheSharpieOne
Copy link
Collaborator

Also, react still warns about using UNSAFE_ methods in strict mode. So by that logic, this PR doesn't work either.
We can replace the lifecycle with hooks. While we would still need a major version bump to update the minimum react version, we would be able to support 16.8+.
Or we can use getDerivedStateFromProps and getSnapshotBeforeUpdate is possible to support 16.3+.

@TheRusskiy
Copy link
Author

If my vote matters I'd say use new lifecycle methods instead of hooks, React 16.8 could cut many people off... Since it's what, 1 year old?

@goxr3plus
Copy link

goxr3plus commented Nov 28, 2019

Like who is using React 13 and 14 , React 17 is almost released , they can use older versions of BlockUI if so . We are blocked because of React 13 and 14 ?

I am getting many warnings from block ui :)

image

@TheSharpieOne
Copy link
Collaborator

TheSharpieOne commented Nov 29, 2019

We are blocked because of React 13 and 14

No, not 13 and 14... but mostly 15 and [early versions of] 16 since they don't have UNSAFE_ to lifecycle methods. But not even that really. This PR's is incomplete since it doesn't bump the version and even then it would still produce warnings in strict mode. A better solution would be to replace the unsafe lifecycle with the new methods.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants