12714/bug/frozen carousels - #12812
Conversation
|
Thank you for submitting this PR, @LUC4SWM! 🤖 Copilot has been assigned for an initial review. @jimchamp is assigned to this PR and currently has:
PR triage checklist (maintainers / Pam)
Note This comment was automatically generated by Pam, Open Library's Project AI Manager, on behalf of @mekarpeles. Pam is designed to provide status visibility, perform basic project management functions and relevant codebase research, and provide actionable feedback so contributors aren't left waiting. |
There was a problem hiding this comment.
Pull request overview
Improves the resilience of the Slick-based carousel “load more” behavior to prevent UI freezes when required i18n inputs are missing or when load-more network requests fail.
Changes:
- Default carousel i18n
loadinglabel to''when thecarousel-i18n-stringsinput is absent. - On
CarouselLoadMorerequest failure, remove the temporary loading slide and unlock the carousel. - Add Jest regression tests covering both failure paths.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tests/unit/js/carousel.test.js | Adds unit tests for missing-i18n and failed load-more behavior. |
| openlibrary/plugins/openlibrary/js/carousel/Carousel.js | Adds defensive i18n default and unlock/cleanup on AJAX failure. |
| .fail(() => { | ||
| this.removeLoadingSlide(); | ||
| loadMore.locked = false; | ||
| }) |
|
|
||
| test('unlocks and removes the loading slide when loading more cards fails', async() => { | ||
| const request = $.Deferred(); | ||
| $.ajax = jest.fn(() => request.promise()); |
Closes #12714
Bug fix
Technical
Makes carousel loading-state handling more defensive in two failure cases:
carousel-i18n-stringsinput is missing, the carousel defaults the loading label to an empty string instead of throwing while attempting to load more cards.CarouselLoadMorerequest fails, the temporary loading slide is removed and the carousel is unlocked so users can continue navigating without refreshing the page.Adds JavaScript regression coverage for both failure paths.
Testing
carousel.test.js/partials/CarouselLoadMore.jsonrequest in DevTools and verified previously loaded slides remain navigable and subsequent navigation can recover without refreshing.Screenshot
Stakeholders