-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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
fix(dashboard): Fill form with the latest values when undo in native filters #16851
fix(dashboard): Fill form with the latest values when undo in native filters #16851
Conversation
Codecov Report
@@ Coverage Diff @@
## master #16851 +/- ##
=======================================
Coverage 76.93% 76.94%
=======================================
Files 1021 1021
Lines 54708 54724 +16
Branches 7459 7468 +9
=======================================
+ Hits 42092 42106 +14
- Misses 12372 12374 +2
Partials 244 244
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
/testenv up FEATURE_DASHBOARD_NATIVE_FILTERS=true FEATURE_DASHBOARD_CROSS_FILTERS=true FEATURE_DASHBOARD_NATIVE_FILTERS_SET=true FEATURE_DASHBOARD_FILTERS_EXPERIMENTAL=true |
@geido Ephemeral environment spinning up at http://54.245.58.103:8080. Credentials are |
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.
Nice work! LGTM with one small question/comment.
!!filterToEdit?.adhoc_filters || !!filterToEdit?.time_range; | ||
!!formFilter?.adhoc_filters || | ||
!!formFilter?.time_range || | ||
!!filterToEdit?.adhoc_filters?.length || | ||
!!filterToEdit?.time_range; |
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.
should we also change it to formFilter?.adhoc_filters?.length ||
like it is later for filterToEdit
, just in case?
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.
Thanks for your feedback! It appears that when the form doesn't have any filters it will just return undefined, reason why I am only checking for that here
@geido If I'm not mistaken when the user removes a filter, it only marks that filter as deleted but the form values are preserved. If that's the case, why do we need the |
@michael-s-molina I checked that and it appears that when the filter is removed the form is also cleaned up. You won't have the most recent state of the form, hence I am storing it on removal and reapplying the values on undo. |
Do you know where the form is being cleared? This is the handler for the delete action and it's only marking it as removed.
|
@michael-s-molina as stated above, I confirm that the form is wiped out as soon as the form rerenders after the remove action. Any data you already have about the filter (such as the one in the |
I was reviewing and found this: This is the code that is clearing the form. |
@geido We can investigate this in a follow-up since this is a P1. For now, let's merge it. |
Ephemeral environment shutdown and build artifacts deleted. |
🏷️ 2021.38 |
…filters (apache#16851) * Set undoFormValues * Reorganize * Revert check * Fix and clean up * Fix pre-filter and sort values (cherry picked from commit d3f6145)
…filters (apache#16851) * Set undoFormValues * Reorganize * Revert check * Fix and clean up * Fix pre-filter and sort values
…filters (apache#16851) * Set undoFormValues * Reorganize * Revert check * Fix and clean up * Fix pre-filter and sort values
SUMMARY
This PR fixes several issues related to the undo functionality in native filters. It stores the latest form data and adds it back to the form when the user removes a filter and then undoes the removal.
BEFORE
See issue #16821
AFTER
Video.Game.Sales.mp4
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION