Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
romgrk committed Jul 5, 2023
1 parent 10a20a6 commit a24e595
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ export function useGridParamsApi(

const getRowValue = React.useCallback<GridParamsApi['getRowValue']>(
(row, colDef) => {
const id = GRID_ID_AUTOGENERATED in row ? row[GRID_ID_AUTOGENERATED] : (getRowId ? getRowId(row) : row.id);
const id =
GRID_ID_AUTOGENERATED in row ? row[GRID_ID_AUTOGENERATED] : getRowId?.(row) ?? row.id;
const field = colDef.field;

if (!colDef || !colDef.valueGetter) {
Expand Down
18 changes: 8 additions & 10 deletions packages/grid/x-data-grid/src/tests/filtering.DataGrid.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -222,30 +222,28 @@ describe('<DataGrid /> - Filter', () => {
it('works with filter', () => {
render(
<TestCase
getRowId={row => row.brand}
getRowId={(row) => row.brand}
filterModel={{
items: [
{ id: 0, field: 'brand', operator: 'contains', value: 'Nike' },
],
items: [{ id: 0, field: 'brand', operator: 'contains', value: 'Nike' }],
}}
/>
/>,
);
expect(getColumnValues(0)).to.deep.equal(['Nike']);
})
});

it('works with quick filter', () => {
render(
<TestCase
getRowId={row => row.brand}
getRowId={(row) => row.brand}
filterModel={{
items: [],
quickFilterValues: ['Nike'],
}}
/>
/>,
);
expect(getColumnValues(0)).to.deep.equal(['Nike']);
})
})
});
});

describe('column type: string', () => {
const getRows = (item: Omit<GridFilterItem, 'field'>) => {
Expand Down

0 comments on commit a24e595

Please sign in to comment.