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

Support React Strict Mode #3361

Closed
stevehollaar opened this issue Feb 15, 2019 · 6 comments · Fixed by #3702
Closed

Support React Strict Mode #3361

stevehollaar opened this issue Feb 15, 2019 · 6 comments · Fixed by #3702

Comments

@stevehollaar
Copy link

Environment

  • Package version(s): @blueprintjs/core: 3.13.0

Feature request

Support React Strict Mode to remove unsafe lifecycles, etc.
See: https://reactjs.org/docs/strict-mode.html

Examples

Currently when wrapping Blueprint components with <React.StrictMode>, several warnings are exposed as console errors:

Warning: findDOMNode is deprecated in StrictMode. findDOMNode was passed an instance of Blueprint3.ResizeSensor which is inside StrictMode. Instead, add a ref directly to the element you want to reference.
componentWillReceiveProps: Please update the following components to use static getDerivedStateFromProps instead: Blueprint3.Overlay, Blueprint3.Popover
componentWillReceiveProps: Please update the following components to use static getDerivedStateFromProps instead: Blueprint3.Spinner,

(There are probably others)

@silverwind
Copy link

silverwind commented Aug 9, 2019

It seems since React 16.9.0, componentWillReceiveProps usage now logs warnings in non-strict mode too while running tests. Please either rename to UNSAFE_componentWillReceiveProps or remove usage.

      Warning: componentWillReceiveProps has been renamed, and is not recommended for use. See https://fb.me/react-async-component-lifecycle-hooks for details.

      * Move data fetching code or side effects to componentDidUpdate.
      * If you're updating state whenever props change, refactor your code to use memoization techniques or move it to static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state
      * Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run `npx react-codemod rename-unsafe-lifecycles` in your project source folder.

      Please update the following components: Blueprint3.Overlay, Blueprint3.Toaster

@noambenami
Copy link

noambenami commented May 12, 2020

I'm using react 16.13.1 and blueprint 3.26.1. I'm still seeing this error....is that expected?

Ah - I see #3979 is still open.

@muratbeser
Copy link

image
I'm also having issues with strict mode.

@BenMcLean981
Copy link

Until there is a fix/update, what should I do?

@Biaggio74
Copy link

Biaggio74 commented Jan 26, 2021

There is an error in React strict mode
React v: 17.0.1
BlueprintJS v: 3.37.0

index.js:1 Warning: findDOMNode is deprecated in StrictMode. findDOMNode was passed an instance of Blueprint3.ResizeSensor which is inside StrictMode. Instead, add a ref directly to the element you want to reference. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-find-node at span at Blueprint3.ResizeSensor (http://localhost:3000/static/js/0.chunk.js:12855:43)

@adidahiya
Copy link
Contributor

See #3979

@palantir palantir locked as resolved and limited conversation to collaborators Jan 26, 2021
@adidahiya adidahiya removed their assignment Jan 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.