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

[DataGrid] Create a new lookup with all the filtered rows, collapsed or not #3715

Closed
wants to merge 5 commits into from

Conversation

flaviendelangle
Copy link
Member

@flaviendelangle flaviendelangle commented Jan 24, 2022

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 keep visible 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)

@flaviendelangle flaviendelangle self-assigned this Jan 24, 2022
@mui-bot
Copy link

mui-bot commented Jan 24, 2022

These are the results for the performance tests:

Test case Unit Min Max Median Mean σ
Filter 100k rows ms 140.5 316 219.8 222.62 71.262
Sort 100k rows ms 289.4 606.6 467.7 466.84 106.477
Select 100k rows ms 131.4 266.5 208.7 196.32 46.045
Deselect 100k rows ms 95.5 300.6 156 155.44 75.303

Generated by 🚫 dangerJS against 6177b40

}
return {
visibleRowsLookup,
filteredRowsLookup,
visibleRowsLookup: filteredRowsLookup,
Copy link
Member

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?

Copy link
Member Author

@flaviendelangle flaviendelangle Jan 24, 2022

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

Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member Author

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 👍

Copy link
Member

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)

Copy link
Member Author

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.

@alexfauquette alexfauquette mentioned this pull request Jan 24, 2022
41 tasks
@cherniavskii
Copy link
Member

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.

So visible is a subset of filtered excluding collapsed rows, right?
In that case we may consider renaming visible to expanded in v6:

-gridVisibleSortedRowEntriesSelector
+gridExpandedSortedRowEntriesSelector

Copy link
Member

@alexfauquette alexfauquette left a 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,
Copy link
Member

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?

@flaviendelangle
Copy link
Member Author

@cherniavskii yes I am talking about it in the description of the PR. 👍

@cherniavskii
Copy link
Member

cherniavskii commented Jan 24, 2022

@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 :)
Also, I just wanted to make sure I understand it correctly, hence the question

@flaviendelangle
Copy link
Member Author

OK :)

For me we have two possibilities in v6:

  1. The new gridFilteredSortedRowEntriesSelector is used on the demo in place of gridVisibleSortedRowEntriesSelector. In which case we can reserve gridVisibleSortedRowEntriesSelector for tree-related scenarios and hence rename it gridExpandedSortedRowEntriesSelector

  2. gridVisibleSortedRowEntriesSelector remains the one we use most of the time because we prefer our code to be "tree-ready". In which case, renaming it with a name like gridExpandedSortedRowEntriesSelector can bring confusion for users not using the tree-related features

The 1. is nice if it's viable because the naming feels right.

@cherniavskii
Copy link
Member

OK :)

For me we have two possibilities in v6:

  1. The new gridFilteredSortedRowEntriesSelector is used on the demo in place of gridVisibleSortedRowEntriesSelector. In which case we can reserve gridVisibleSortedRowEntriesSelector for tree-related scenarios and hence rename it gridExpandedSortedRowEntriesSelector
  2. gridVisibleSortedRowEntriesSelector remains the one we use most of the time because we prefer our code to be "tree-ready". In which case, renaming it with a name like gridExpandedSortedRowEntriesSelector can bring confusion for users not using the tree-related features

The 1. is nice if it's viable because the naming feels right.

Right, nr. 2 really might be confusing

@flaviendelangle
Copy link
Member Author

I don't understand why the build fails like that...

@flaviendelangle flaviendelangle deleted the filter-rows branch January 25, 2022 12:33
@oliviertassinari oliviertassinari added the component: data grid This is the name of the generic UI component, not the React module! label Jan 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: data grid This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants