-
Notifications
You must be signed in to change notification settings - Fork 6
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
Don't render AddressNL component when it hidden #786
Conversation
…when not hidden The AddressNL component should only be rendered when it's not hidden. Otherwise, the attach function will call `createRoot` with an argument that isn't a DOM element. So the creating of the root and, therefor, the rendering of the React component cannot be done. If the reactRoot doesn't exist, then it also doesn't (and cannot) be unmounted. So this is also something that shouldn't happen when the component is hidden. This works fine when the component is hidden/shown using form logic, as the `hidden` property will be updated.
Bundle ReportChanges will increase total bundle size by 292 bytes (0.0%) ⬆️. This is within the configured threshold ✅ Detailed changes
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #786 +/- ##
==========================================
- Coverage 83.32% 83.31% -0.02%
==========================================
Files 239 239
Lines 4750 4753 +3
Branches 1268 1277 +9
==========================================
+ Hits 3958 3960 +2
- Misses 757 758 +1
Partials 35 35
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
I a bit confused..which part of the ticket is this solving?
-
I see here we have a css rule for hidden components but I guess this is not useful in this situation. And where do we handle the "hidden" components and prevent them from being rendered?
https://github.com/open-formulieren/open-forms-sdk/blob/main/src/formio/components/Component.js
Discussed these remarks/questions in person with Robin, so for me this update in the code makes sense. |
Partly closes: open-formulieren/open-forms#4699
The AddressNL component should only be rendered when it's not hidden. Otherwise, the attach function will call
createRoot
with an argument that isn't a DOM element. (Which causes an error being thrown in the front-end..)So the creating of the root and, therefor, the rendering of the React component cannot be done. If the reactRoot doesn't exist, then it also doesn't (and cannot) be unmounted. So this is also something that shouldn't happen when the component is hidden.
This works fine when the component is hidden/shown using form logic, as the
hidden
property will be updated.