-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Fix AutocompleteInput only display the first 1000 choices #7884
Conversation
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.
A test would be welcome
[skip ci]
@@ -160,6 +160,25 @@ export const useList = <RecordType extends RaRecord = any>( | |||
Object.entries(filterValues).every( | |||
([filterName, filterValue]) => { | |||
const recordValue = get(record, filterName); | |||
|
|||
if (!recordValue) { |
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.
You're testing the value regardless of the filter name. I don't understand what you're doing here. Can you please add a comment to clarify it?
@@ -935,4 +938,35 @@ describe('<AutocompleteInput />', () => { | |||
screen.getByText('No options'); | |||
}); | |||
}); | |||
|
|||
it('should not display "Dalmatian #1001" when given no `perPage` parameters and a list of 1001 dalmatians', async () => { |
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.
it('should not display "Dalmatian #1001" when given no `perPage` parameters and a list of 1001 dalmatians', async () => { | |
it('should limit the number of options to the value of the perPage prop', async () => { |
expect(screen.queryByText('Dalmatian #1001')).toBeNull(); | ||
}); | ||
|
||
it('should display "Dalmatian #1001" when given `perPage=1001` parameters and a list of 1001 dalmatians', async () => { |
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.
In the test description, speak about the feature you're testing, not the dataset you're using
mutationMode="pessimistic" | ||
mutationOptions={{ | ||
onSuccess: data => { | ||
console.log(data); |
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.
console.log spotted
); | ||
}; | ||
|
||
export const VeryLargeOptionsNumber = (props: { |
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.
Name that Story PerPage, because that's what it demonstrates
|
||
export const VeryLargeOptionsNumber = (props: { | ||
perPage?: number; | ||
includeAdmin?: boolean; |
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.
unused
@@ -276,11 +278,6 @@ If you provided a React element for the optionText prop, you must also provide t | |||
if (setFilter) { | |||
return setFilter(filter); | |||
} | |||
|
|||
if (choicesProp) { |
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.
why did you remove that?
Superseded by #7889 |
Fixes #7880