Channels: forward AJAX loading#4924
Conversation
- better detection for running out of records - will load all items with quick look next page - more responsive interface
demiankatz
left a comment
There was a problem hiding this comment.
@crhallberg, it looks like there are some minor eslint issues that need to be addressed to make the build happy.
As for what I would call this feature, I do feel like I used some useful name in the past, but now I can't remember what it was either! This is probably not what I said before, but "lookahead loading" might be a good name for it.
demiankatz
left a comment
There was a problem hiding this comment.
Also, I've found a useful way to test the edge cases here. It seems like things are improved but not 100% correct yet.
Using the standard test environment, edit channels.ini with these changes:
- cache_home_channels = false
- in [provider.facets.home], itemsPerRow = 2 and maxBatchSize = 8
When you go to the default Channels home page, the first channel should be "Topic: Research" which should contain 16 records (you can confirm this using the "show as search results" link in the channel options). Thus, with the above settings, we expect there to be exactly two batches loaded from the server, with no remainder -- so it's good for testing edge cases.
With these settings, the dev branch only gives me 10 of the 16 results before giving up when I use the "more" button (and I can only navigate through 8 using the quick look next button).
On this branch, I can get through all 16 records using the quick look next button, but if I use the "Load more items" button in the channel itself, it gives up after retrieving only 14. Hopefully that's not too hard to fix!
demiankatz
left a comment
There was a problem hiding this comment.
@crhallberg, I've resolved conflicts here, but when I run the ChannelsTest, it fails with this:
There was 1 failure:
1) VuFindTest\Mink\ChannelsTest::testDeepPaginationOfFacetsChannel
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'Load more items into Format: Book Chapter'
+'Load more items'
/usr/local/vufind/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/ChannelsTest.php:445
FAILURES!
Tests: 12, Assertions: 158, Failures: 1.
The issue seems to be that an aria-label is not getting set as specifically as before. I am running short on time, so I haven't dug too deeply into this. Any ideas?
demiankatz
left a comment
There was a problem hiding this comment.
The previous edge case I reported is fixed, but now I've found a different case that is broken.
If you use my previously-described test scenario, but set itemsPerRow to 10 and maxBatchSize to 20 in [provider.facets.home], there is now some incorrect behavior in the "Topic: Research" channel.
It initially loads 10 items as expected. If I click "load more items," I get six more results -- but the "load more" button remains visible. If I click it again, it changes to "loading..." and never goes away. Is it possible that the unconditional enabling of the more button in line 251 is a problem, or is it something else?
|
I should also note that the test failure mentioned above is still an issue. |
Query for the next batch of results when we have one page or less hidden.
I forget the term Demian used for this, so I'm going with "forward loading" until I'm reminded.