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

findDOMNode warning when using loadingBox #1065

Closed
jamesderrick opened this issue Mar 28, 2022 · 1 comment · Fixed by #1068
Closed

findDOMNode warning when using loadingBox #1065

jamesderrick opened this issue Mar 28, 2022 · 1 comment · Fixed by #1068

Comments

@jamesderrick
Copy link

I've just started using the govuk react components and am currently looking at implementing a LoadingBox. If I try and use state to toggle the loading I get a warning. It works fine, but I would like to find a way to avoid the warning.

Steps to reproduce the behavior:

  1. Create a component with a LoadingBox
<LoadingBox loading={loading}>
          <H1>Input Form</H1>
          <InputField
              onChange={(e) => setInputData(e.target.value)}
              hint={<>Enter your post below</>}
              mb={4}
              meta={{
                error: error,
                touched:true
              }}
          >
              Add A Post
          </InputField>
          <Button 
              onClick={handlePostData}
              mb={9}
          >
              SUBMIT
          </Button>
</LoadingBox>
  1. useState to control the loading
const [loading, setLoading] = useState(false);
  1. In the handlePostData function setLoading(true)
  2. At the end of the handlePostData setLoading(false)

Expected behavior
Was not expecting an error and haven't been able to figure out a way of silencing it, other than removing StrictMode which I don't want to do.

Screenshots
Screenshot 2022-03-28 at 11 04 13

  • OS: Windows 10
  • Browser: All (tested on latest Edge and Chrome)
@penx
Copy link
Member

penx commented Mar 28, 2022

This seems to be coming from our use of react-transition-group@^4.2.1

https://github.com/reactjs/react-transition-group

This seems to be a known issue, we could try upgrading the library and there's a thread here that perhaps contains a fix we could use:

reactjs/react-transition-group#668

penx added a commit that referenced this issue Apr 8, 2022
This helps prove issue relating to #1065
penx added a commit that referenced this issue Apr 8, 2022
This helps prove issue relating to #1065
penx added a commit that referenced this issue Apr 8, 2022
@penx penx closed this as completed in #1068 Apr 8, 2022
penx added a commit that referenced this issue Apr 8, 2022
* Upgrade to React 17 & enable strict mode in tests

This helps prove issue relating to #1065

* Fix deprecated warning from loading box

Fixes #1065

* Require hooks everywhere

* Don't test for warnings from rjsf
@penx penx mentioned this issue Apr 8, 2022
penx added a commit that referenced this issue Apr 8, 2022
- Set storybook to be based on light theme #1048
- Fix warning from LoadingBox #1068 #1065
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

Successfully merging a pull request may close this issue.

2 participants