-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
perf, memory: Improve performance and memory use for large datasets #5927
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
base: main
Are you sure you want to change the base?
Changes from 5 commits
73a6b1e
0cc9f19
3ff5df9
a964f41
24710f8
0769660
3620a00
aa518e9
fdc1771
9cf94c1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| import { RowModel } from '..' | ||
| import { getRowProto, RowModel } from '..' | ||
| import { BuiltInFilterFn, filterFns } from '../filterFns' | ||
| import { | ||
| Column, | ||
|
|
@@ -362,14 +362,6 @@ export const ColumnFiltering: TableFeature = { | |
| } | ||
| }, | ||
|
|
||
| createRow: <TData extends RowData>( | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the core I haven't thought all the details through but something like retaining a That way we could also retain the
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1 to generally recommending people use the same approach for implementing custom features. I considered making things more explicit by adding methods like
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This kind of pattern will be useful to think about in the alpha branch though |
||
| row: Row<TData>, | ||
| _table: Table<TData> | ||
| ): void => { | ||
| row.columnFilters = {} | ||
| row.columnFiltersMeta = {} | ||
| }, | ||
|
|
||
| createTable: <TData extends RowData>(table: Table<TData>): void => { | ||
| table.setColumnFilters = (updater: Updater<ColumnFiltersState>) => { | ||
| const leafColumns = table.getAllLeafColumns() | ||
|
|
@@ -411,6 +403,23 @@ export const ColumnFiltering: TableFeature = { | |
|
|
||
| return table._getFilteredRowModel() | ||
| } | ||
|
|
||
| Object.assign(getRowProto(table), { | ||
|
||
| get columnFilters() { | ||
| // Lazy-init the backing cache on the instance so we don't take up memory for rows that don't need it | ||
| return (( | ||
| this as { _columnFilters?: ColumnFiltersRow<any>['columnFilters'] } | ||
| )._columnFilters ??= {}) | ||
| }, | ||
| get columnFiltersMeta() { | ||
| // Lazy-init the backing cache on the instance so we don't take up memory for rows that don't need it | ||
| return (( | ||
| this as { | ||
| _columnFiltersMeta?: ColumnFiltersRow<any>['columnFiltersMeta'] | ||
| } | ||
| )._columnFiltersMeta ??= {}) | ||
| }, | ||
| } as ColumnFiltersRow<any> & Row<any>) | ||
| }, | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.