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

Prepare for upcoming react deprecations introduced in 16.3 #2732

Closed
justinobney opened this issue Apr 22, 2018 · 28 comments
Closed

Prepare for upcoming react deprecations introduced in 16.3 #2732

justinobney opened this issue Apr 22, 2018 · 28 comments
Labels

Comments

@justinobney
Copy link

justinobney commented Apr 22, 2018

Suggestion: begin migration to new react lifecycles while retaining backwards compatibility via react-lifecycles-compat

Example: https://www.youtube.com/watch?v=G9S1IghlkCI

Steps

  • Use new lifecycle methods introduced in react 16.3 in a component that renders react-semantic-ui components.

Expected Result

  • React does not log errors/warning about upcoming deprecations to the console.

Actual Result

  • React IS logging errors/warning about upcoming deprecations to the console.

Version

0.79.1

Testcase

@welcome
Copy link

welcome bot commented Apr 22, 2018

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you've completed all the fields in the issue template so we can best help.

We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

@levithomason
Copy link
Member

@justinobney this is great, could you start a PR for this?

@joshuaobrien
Copy link

Is this up for grabs? I'm happy to do it.

@justinobney
Copy link
Author

@joshuaobrien that would be great. I doubt I could get to it for a few weeks.

@joshuaobrien
Copy link

I'm on it. Will get started on the weekend :)

@msrikanth508
Copy link
Contributor

I would like to start on this, Couple of life cycle methods are marked as UNSAFE in 16.3 and two new methods getDerivedStateFromProps, getSnapshotBeforeUpdate got introduced. @levithomason what exactly do we need to do?

@joshuaobrien
Copy link

Hi @msrikanth508, I am working on this at the moment. What we need to do is refactor the components that use the deprecated methods so that they no longer use them. Functionality that was in these deprecated lifecycle methods needs to be moved into other lifecycle methods.

My experiences so far is that these changes are not always clean cut. Also, changes to tests are likely required to accommodate the new methods.

@gavinmeier25
Copy link

Is this still needed I would be happy to hop on it this upcoming weekend and take a gander?

@layershifter
Copy link
Member

Yep, feel free to pickup 👍

@tri-hoang
Copy link

I would love to work on this if it's still needed?

@joshuaobrien
Copy link

joshuaobrien commented Aug 27, 2018

It's still needed. I haven't got around to it. There is a PR here: #2757

@kaiz123
Copy link

kaiz123 commented Oct 23, 2018

Hey is this still open to work on @justinobney @joshuaobrien

kohakukun added a commit to kohakukun/Semantic-UI-React that referenced this issue Oct 28, 2018
- Remove unsafe lifecycles:
  - `componentWillMount`
  - `componentWillRecieveProps`
  - `componentWillUpdate`

Relates to Semantic-Org#2732
@kohakukun
Copy link
Contributor

In case nobody has addressed this, I created a PR #3244 .

kohakukun added a commit to kohakukun/Semantic-UI-React that referenced this issue Oct 28, 2018
Remove unsafe lifecycles from `AutoControlledComponent` and affected
components:
- `componentWillMount`
- `componentWillRecieveProps`
- `componentWillUpdate`

Relates to Semantic-Org#2732
kohakukun added a commit to kohakukun/Semantic-UI-React that referenced this issue Oct 28, 2018
Remove unsafe lifecycles from `AutoControlledComponent` and affected
components:
- `componentWillMount`
- `componentWillRecieveProps`
- `componentWillUpdate`

Relates to Semantic-Org#2732
@layershifter
Copy link
Member

to be returned - this uses findDOMNode, which is also a violation of StrictMode.

@danpantry It's unfixable as there are no alternative, so we are not going to fix. Once the feature from reactjs/rfcs#97 will be released, we will update to it.

jmyrland pushed a commit to jmyrland/Semantic-UI-React that referenced this issue Aug 15, 2019
Executed via `npx react-codemod rename-unsafe-lifecycles --parser babel`
Disabled lint issues for updated lines.

Closes Semantic-Org#3741
Related to Semantic-Org#2732
layershifter pushed a commit that referenced this issue Aug 16, 2019
* chore(mixed): renamed unsafe lifecycle methods

Executed via `npx react-codemod rename-unsafe-lifecycles --parser babel`
Disabled lint issues for updated lines.

Closes #3741
Related to #2732

* bump react to ensure that CI will pass

* disable broken UTs
@punmechanic
Copy link

@layershifter: Hello, from the future :)

It appears that reactjs/rfcs#97 has been closed and while there are two proposed approaches, it seems unlikely that either will land before Suspense ships.

@Celludriel
Copy link

What does this mean for now ? I'm a day into development for a small ui application at work now with semantic-ui and I am hitting this deprecation warning. If this won't be fixed I can't put code in production with warnings in the console popping up. Will it get fixed eventually ?

@punmechanic
Copy link

@Celludriel The deprecation warnings are nothing to worry about unless you intend to upgrade to a version of React which removes the unsupported lifecycle methods. It doesn't appear that React will be removing them for a long time, but you should be aware that certain components that you're using within Semantic, for the time being, will not support concurrent mode and so may have subtle bugs.

If you're not using concurrent mode, it's probably not an issue.

As for whether or not it will get fixed, I imagine it will, but there problems that prevent the fix from happening right now.

@Celludriel
Copy link

@danpantry

Thanks for the information, I disabled strict mode for now so the warning doesn't pop up since our security department is pretty strict when it comes to warnings in the console. Even if it's non sensical they should worry about it.

I'll await the future if it will get fixed later on. Just glad I don't have to switch ui libraries since this one is working just fine for me now

@layershifter
Copy link
Member

Addressing .findDOMNode() will be a complicated issue as all components should start to use forwardRef().

I am fixing UNSAFE_ warning under #3919, .findDOMNode() will be a next point.

@erasmuswill
Copy link

Hi guys. Do you need any help with this?

@brianespinosa
Copy link
Member

I believe the rest of these deprecated methods are being resolved in #3956, after which I believe this issue can be closed.

@raymondshiner
Copy link

Any more updates on this? This feature is highly anticipated, semantic ui react in its current version throws so many warnings related to this.

@layershifter
Copy link
Member

Progress is tracked #3919 and a lot of work was already done:

image

#3956 is remaining to fix lifecycle warnings completely. It's quite complicated as requires tons of refactoring.


Until this will be funded in any way I can't allocate more time for this.

@layershifter layershifter changed the title Prepare for upcoming react lifecycle deprecations introduced in 16.3 Prepare for upcoming react deprecations introduced in 16.3 Jul 16, 2020
@layershifter
Copy link
Member

Short update: #3919 was completed and all changes in master should be shipped soon.
Refs handling is a separate thing and work will be tracked under #3819.

@layershifter
Copy link
Member

Fixes for lifecycles were released in [email protected] 🎉

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

No branches or pull requests