-
-
Notifications
You must be signed in to change notification settings - Fork 1.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
[DataGrid] Create a new lookup with all the filtered rows, collapsed or not #3715
Conversation
…t matter there ancestor expansion status
These are the results for the performance tests:
|
packages/grid/_modules_/grid/hooks/features/filter/gridFilterState.ts
Outdated
Show resolved
Hide resolved
} | ||
return { | ||
visibleRowsLookup, | ||
filteredRowsLookup, | ||
visibleRowsLookup: filteredRowsLookup, |
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.
So rows that are collapsed will be included in visibleRowsLookup
, but with value set to false
?
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.
The behavior of visibleRowsLookup
remains the same
The collapsed rows are included with value set to false
yes
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.
When reading it alone, it feels like "Why are you saving two times the same thing?"
A comment such as "visibleRowsLookup will be modified by the treeData and rowGrouping hook" could help to keep in mind which part of the code will reuse the difference between them.
By the way, don't you need to use visibleRowsLookup: {...filteredRowsLookup}
to avoid side effects on filteredRowsLookup
when modifying visibleRowsLookup
?
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.
This lookup can be huge so I wanted to avoid doubling the memory allocated.
Mutating those lookup should cause tons of other issues since they are used in lots of places.
But the trade-off is debatable. Maybe the RAM is not an issue even for large list of rows.
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'll add a comment to explain why we return the same thing twice 👍
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.
If you do not double the memory consumption, how do you do to double the number of information per row?
The only solution to avoid useless consumption of memory I see is to do the copy in tree data function, such that if tree data and grouping is not used, the objects are the same (which is not a problem)
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.
For the flat tree, I dont do visibleRowsLookup: {...filteredRowsLookup}
, that way I don't increase the memory used.
For non-flat tree, I do double the memory used, but as you say, the two lookups being different it's logical.
The line we are commenting is only used for the flat tree.
So -gridVisibleSortedRowEntriesSelector
+gridExpandedSortedRowEntriesSelector |
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 have added a point in #3287 for the v6 naming modification
} | ||
return { | ||
visibleRowsLookup, | ||
filteredRowsLookup, | ||
visibleRowsLookup: filteredRowsLookup, |
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.
When reading it alone, it feels like "Why are you saving two times the same thing?"
A comment such as "visibleRowsLookup will be modified by the treeData and rowGrouping hook" could help to keep in mind which part of the code will reuse the difference between them.
By the way, don't you need to use visibleRowsLookup: {...filteredRowsLookup}
to avoid side effects on filteredRowsLookup
when modifying visibleRowsLookup
?
@cherniavskii yes I am talking about it in the description of the PR. 👍 |
Right, I've read it and that's my proposal for renaming :) |
OK :) For me we have two possibilities in v6:
The 1. is nice if it's viable because the naming feels right. |
Right, nr. 2 really might be confusing |
I don't understand why the build fails like that... |
Part of #3610
I will modify the default behavior in #3610 or in a standalone PR if #3610 is merged before so that the CSV export has the collapsed rows by default.
In term of naming, we are stuck before v6 with our current "visible" prefix which is not great.
So right now we have:
visible
=> all the rows given to the pagination process, they pass the filtering process AND they are not collapsed.filtered
=> all the rows that pass the filtering process, whether they are collapsed or not.We should find a better name than
visible
in v6 and keepvisible
for the use case where we are talking about the rows currently displayed on the screen.Closed in favor of #3736 (CircleCI has a weird bug)