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

CMS 5: Still using various deprecated lifecycle events which should be avoided #1414

Closed
2 tasks
GuySartorelli opened this issue Dec 11, 2022 · 4 comments
Closed
2 tasks

Comments

@GuySartorelli
Copy link
Member

GuySartorelli commented Dec 11, 2022

#1312 results in some regressions which we've decided to handle as separate issues. This is one of those.

Many of our react components implement a componentWillReceiveProps method. This results in a console warning that this method is deprecated. We should refactor our components to not use this method to avoid upgrade pains in the future.
There may be other deprecated lifecycle events in use as well.

Acceptance Criteria

  • None of the react components in supported modules use componentWillReceiveProps
  • No other deprecated lifecycle events are used in supported modules

Notes

  • see this blog post which includes more information and suggestions for alternative solutions for the problems this method typically solves.
  • If it comes to a point where it's just too hard to refactor, we can use npx react-codemod rename-unsafe-lifecycles to suppress console warnings - but that should be a last resort (we'll have to remove them eventually)

PRs

@maxime-rainville
Copy link
Contributor

Sadly we will not get to this in CMS5.

@GuySartorelli
Copy link
Member Author

Reopening - we could happily do this in a minor and it does need to be done eventually.

@GuySartorelli GuySartorelli reopened this Feb 2, 2023
@GuySartorelli GuySartorelli changed the title CMS 5: componentWillReceiveProps is deprecated and should be avoided CMS 5: Still using varioud deprecated lifecycle events which should be avoided Feb 9, 2023
@GuySartorelli GuySartorelli changed the title CMS 5: Still using varioud deprecated lifecycle events which should be avoided CMS 5: Still using various deprecated lifecycle events which should be avoided Feb 9, 2023
@emteknetnz emteknetnz self-assigned this Mar 27, 2023
@emteknetnz
Copy link
Member

As far as I can tell we've overestimated the amount of work required in this issue, I could only find a single relevant component that needed updating.

All the other components were updated as part of #1312

I search searched sink 5.0 for the following strings that would mean the deprecated lifecycle methods are actually being called:

  • "componentWillMount("
  • "componentWillReceiveProps("
  • "componentWillUpdate("

It only matched bundle.js style files + the 2x files included in the PRs above

@GuySartorelli
Copy link
Member Author

PRs merged

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

No branches or pull requests

3 participants