Skip to content

CModal component is using a deprecated findDOMNode to create a Transition component in StrictMode. #127

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

Closed
Nelias opened this issue Jul 13, 2020 · 2 comments

Comments

@Nelias
Copy link

Nelias commented Jul 13, 2020

This is the error that I am receiving in a console:

Warning: findDOMNode is deprecated in StrictMode. findDOMNode was passed an instance of Transition which is inside StrictMode. Instead, add a ref directly to the element you want to reference. Learn more about using refs safely here: https://fb.me/react-strict-mode-find-node
    in div (created by Transition)
    in Transition (created by CModal)
    in div (created by CModal)
    in CModal (at xyz-modal.tsx:46)
    in XYZModal (at xyz.tsx:112)
    in div (created by Container)
    in Container (at xyz.tsx:37)
    in XYZ (at content.tsx:31)
    in div (created by Transition)
    in Transition (created by CFade)
    in CFade (at content.tsx:30)
    in Route (at content.tsx:25)
    in Switch (at content.tsx:21)
    in Suspense (at content.tsx:20)
    in div (created by CContainer)
    in CContainer (at content.tsx:19)
    in main (at content.tsx:18)
    in Content (at admin.tsx:12)
    in div (at admin.tsx:11)
    in div (at admin.tsx:9)
    in div (at admin.tsx:7)
    in Admin (created by Context.Consumer)
    in Route (at app.tsx:63)
    in Switch (at app.tsx:31)
    in Router (created by BrowserRouter)
    in BrowserRouter (at app.tsx:30)
    in App (at src/index.tsx:14)
    in Provider (at src/index.tsx:13)
    in StrictMode (at src/index.tsx:12)

Adding a innerRef={refSupplierModal} to CModal props with use of either createRef() or useRef() hooks does not fix this issue.

This could be a way to fix it: https://stackoverflow.com/questions/60802216/warning-finddomnode-is-deprecated-in-strictmode-react-redux-notify #

There was a similar issue in react-bootstrap: react-bootstrap/react-bootstrap#3518

@woothu
Copy link

woothu commented Jul 14, 2020

This is deprecation in the library that we use, not ours.

The solution you gave is not fixing it, disabling strict mode just disables some warnings

We will look for an opportunity to update the Transition component in the next minor version

@zifik
Copy link

zifik commented Mar 17, 2022

I am getting this error with CModal v4.1.2.

Warning: findDOMNode is deprecated in StrictMode. findDOMNode was passed an instance of Transition which is inside StrictMode. Instead, add a ref directly to the element you want to reference.
<CModal
  size="sm"
  alignment="center"
  backdrop="static"
  visible={loadingState.isBusy}
>
  <CModalBody className="text-center">
    <CSpinner component="span" />
    <h3>{loadingState.message}</h3>
  </CModalBody>
</CModal>

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

3 participants