Added record filter hidden fields in query (#18149)
Fixes https://github.com/twentyhq/twenty/issues/17506 Hidden fields are now queried when they are in record filters, to avoid optimistic and filtering bugs with hidden fields.
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
import { filterDuplicatesById } from '@/utils/array/filterDuplicatesById';
|
||||
|
||||
type ObjectRecordTest = { id: string };
|
||||
|
||||
describe('filterDuplicatesById', () => {
|
||||
it('should work with empty array', () => {
|
||||
const array: ObjectRecordTest[] = [];
|
||||
|
||||
const filteredArray = array.filter(filterDuplicatesById);
|
||||
|
||||
expect(filteredArray).toEqual([]);
|
||||
});
|
||||
|
||||
it('should work with no duplicates', () => {
|
||||
const array: ObjectRecordTest[] = [
|
||||
{
|
||||
id: '1',
|
||||
},
|
||||
{
|
||||
id: '2',
|
||||
},
|
||||
];
|
||||
|
||||
const filteredArray = array.filter(filterDuplicatesById);
|
||||
|
||||
expect(filteredArray).toEqual(array);
|
||||
});
|
||||
|
||||
it('should work with one duplicate', () => {
|
||||
const array: ObjectRecordTest[] = [
|
||||
{
|
||||
id: '1',
|
||||
},
|
||||
{
|
||||
id: '1',
|
||||
},
|
||||
];
|
||||
|
||||
const filteredArray = array.filter(filterDuplicatesById);
|
||||
|
||||
expect(filteredArray).toEqual([{ id: '1' }]);
|
||||
});
|
||||
|
||||
it('should work with multiple duplicates', () => {
|
||||
const array: ObjectRecordTest[] = [
|
||||
{
|
||||
id: '1',
|
||||
},
|
||||
{
|
||||
id: '1',
|
||||
},
|
||||
{
|
||||
id: '2',
|
||||
},
|
||||
{
|
||||
id: '3',
|
||||
},
|
||||
{
|
||||
id: '3',
|
||||
},
|
||||
];
|
||||
|
||||
const filteredArray = array.filter(filterDuplicatesById);
|
||||
|
||||
expect(filteredArray).toEqual([
|
||||
{
|
||||
id: '1',
|
||||
},
|
||||
{
|
||||
id: '2',
|
||||
},
|
||||
{
|
||||
id: '3',
|
||||
},
|
||||
]);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user