Skip to content

Channels: forward AJAX loading#4924

Open
crhallberg wants to merge 4 commits into
vufind-org:devfrom
crhallberg:channels-ajax-next
Open

Channels: forward AJAX loading#4924
crhallberg wants to merge 4 commits into
vufind-org:devfrom
crhallberg:channels-ajax-next

Conversation

@crhallberg
Copy link
Copy Markdown
Contributor

Query for the next batch of results when we have one page or less hidden.

  • better detection for running out of records
  • will load all items with quick look next page
  • more responsive interface

I forget the term Demian used for this, so I'm going with "forward loading" until I'm reminded.

- better detection for running out of records
- will load all items with quick look next page
- more responsive interface
Copy link
Copy Markdown
Member

@demiankatz demiankatz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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 demiankatz added this to the 11.1 milestone Dec 3, 2025
Copy link
Copy Markdown
Member

@demiankatz demiankatz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

Copy link
Copy Markdown
Member

@demiankatz demiankatz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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?

Copy link
Copy Markdown
Member

@demiankatz demiankatz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@demiankatz
Copy link
Copy Markdown
Member

I should also note that the test failure mentioned above is still an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants