-
Notifications
You must be signed in to change notification settings - Fork 633
CardView: dataController -> paging in the remote OData DataSource not working #29877
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: 25_1
Are you sure you want to change the base?
Conversation
}; | ||
}; | ||
|
||
describe('regressions', () => { |
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.
Can we rename the description to 'DataController' ? I think current name isn't suitable and doesn't follow the way other testing files have their descriptions.
if (!equalByValue( | ||
this.previousDisplayFilter ?? null, | ||
displayFilter ?? null, | ||
{ | ||
maxDepth: FILTER_OBJ_COMPARE_DEPTH, | ||
strict: true, | ||
}, | ||
)) { |
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 (!equalByValue( | |
this.previousDisplayFilter ?? null, | |
displayFilter ?? null, | |
{ | |
maxDepth: FILTER_OBJ_COMPARE_DEPTH, | |
strict: true, | |
}, | |
)) { | |
const filterChanged = !equalByValue( | |
this.previousDisplayFilter ?? null, | |
displayFilter ?? null, | |
{ | |
maxDepth: FILTER_OBJ_COMPARE_DEPTH, | |
strict: true, | |
}, | |
); | |
if (filterChanged) { |
describe('when displayFilter and filter from dataSource are empty', () => { | ||
it('should return empty filter', () => { |
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.
Maybe just?:
describe('when displayFilter and filter from dataSource are empty', () => { | |
it('should return empty filter', () => { | |
it('should return empty filter when displayFilter and filter from dataSource are empty', () => { |
I doubt that there will be any other tests in this describe block.
dataSourceFilter: ['a', '=', 123], | ||
columnFilterValues: [1, 2], | ||
}); | ||
expect(gridCore.getCombinedFilter()).toMatchInlineSnapshot(` |
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.
can we use toEqual here too? Just to be consistent
dataSourceFilter: undefined, | ||
columnFilterValues: [1, 2], | ||
}); | ||
expect(gridCore.getCombinedFilter()).toMatchInlineSnapshot('undefined'); |
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.
can we use toEqual/toBe here too? Is there any specific reason why toMatchInlineSnapshot was used?
PR consist of two commits:
fix: bug
Direct fix of the bug described in the card.
Problem: each time some loadOption is changed, we call effect to pass changed values to dataSource and call
.load
if we need it.In case of filtering, we were passing the
displayFilter.value ?? null
to dataSource, but the displayField could also beundefined
. In result, we passed each time the 'null' value, but we were comparing it withundefined
each time.Because of this, filter was set each time when any loadOption was changed, and there's internal dataSource logic to drop pageIndex after filtering is changed (since it could lead to changes in totalCount)
fix: getCombinedFilter
I noticed that we didn't have proper logic for getCombinedFilter and fixed it
When we were syncing cardview's display filter to dataSource filter, we were just calling
dataSource.filter(displayFilter)
. However, dataGrid behaves in different way:Filter, specified in DataSource, is never changed, and is used as 'initial top-level filter'. When we set filter by UI, displayFilter (called additionalFilter in DataGrid) was combined to filter in DataSource, not overwrite it.
I added combineFilter method, used it in
customizeStoreLoadOptions
callback and fixed public methodgetCombinedFilter