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

using UNSAFE_componentWillMount in strict mode #213

Open
ali-eljerrari opened this issue Jan 4, 2024 · 1 comment
Open

using UNSAFE_componentWillMount in strict mode #213

ali-eljerrari opened this issue Jan 4, 2024 · 1 comment

Comments

@ali-eljerrari
Copy link

Warning: Using UNSAFE_componentWillMount in strict mode is not recommended and may indicate bugs in your code. See https://reactjs.org/link/unsafe-component-lifecycles for details.

  • Move code with side effects to componentDidMount, and set initial state in the constructor.

Please update the following components: SideEffect(NullComponent2)

any fix for this warning???

@ali-eljerrari ali-eljerrari changed the title sing UNSAFE_componentWillMount in strict mode using UNSAFE_componentWillMount in strict mode Jan 4, 2024
@gilluminate
Copy link

After some extensive debugging of the code, I've determined that componentWillMount in the Dispatcher.tsx file is firing after the init when using this package in a NextJS project. This causes the helmetInstances object to be removed and never gets applied. This is the only reason no one is able to use this package for client side <head> updates in NextJS's new App routing! I'm guessing this affects other similar frameworks as well.

As per the 6 year old note in the code

  // componentWillMount will be deprecated
  // for SSR, initialize on first render
  // constructor is also unsafe in StrictMode

Can that simply be removed entirely?

(side note: componentDidUpdate never even fires)

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

No branches or pull requests

2 participants