fix(cat-combo-table): prevent filter from unmounting data-elements #186
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes TECH-1217
Filtering out dataElements removes them from the tree, and thus clears the state of the fields. Instead this uses
display: noneto prevent the nodes from being unmounted. This also seems to improve the filtering performance, as we prevent fields from unsubscribing and resubscribing to RFF and other hooks.Not sure if this has any unintended side-effects, but I haven't seen any from my limited testing.
Edit: Might need to come back to this. It might make sense to move "syncing"-state to a react-final-form mutator. Will research more when looking at #182 .
Codesandbox with a similar use-case: https://codesandbox.io/s/7k742qpo36?file=/index.js