-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Stored "currentPage" offset can cause admin UI list view to display nothing #2063
Comments
An even simpler way to reproduce this is to create a batch of items and set |
I'm new to Keystone - how is |
keystone.createList('SelectTest', {
fields: {
options: {
type: Select,
options: ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o'],
},
},
adminConfig: {
defaultPageSize: 2,
},
}); |
Another way to repoduce this is to add I'd say this is not a bug but expected behaviour in most cases. We could attempt to detect when the current page is beyond the length of the list given the page length but this get tricky because with permissions on items we might not know exactly how many items the user can see. The only other way I can think to 'solve' this is before rendering 'No ___s to display' we make sure the page is set to 0. |
Bug report
Describe the bug
Keystone's admin UI remembers the last "currentPage" offset that the user navigated for a particular list (via the admin UI's pagination controls). This can cause problems when enough items are removed from a list such that the remembered "currentPage" is offset beyond the remaining number of items in that list. In such situations, the admin UI incorrectly show the "No items to display yet.." message for the list view, even though there is still data present in that list.
To Reproduce
Steps to reproduce the behaviour:
1.Populate a list Foo with a few hundred items of data
2. View the Foo list in the admin ui, and navigate to the final page of data for the list via the pagination controls
3. Execute a mutation, and delete half the items in the Foo list
4. Reload the admin ui, and navigate to Foo in the admin ui
5. The admin ui shows message "No foos to display yet..", even though there is still data in this list.
Expected behaviour
1.Populate a list Foo with a few hundred items of data
2. View the Foo list in the admin ui, and navigate to the final page of data for the list via the pagination controls
3. Execute a mutation, and delete half the items in the Foo list
4. Reload the admin ui, and navigate to Foo in the admin ui
5. The admin ui should, by default, show the data that still exists in the Foo list. My preference would be for the admin ui to "self correct" the "currentPage" offset back to "0" in the case that it's "remembered" offset exceeded the total count of items in the list.
The text was updated successfully, but these errors were encountered: