Skip to content

Conversation

@RohitR311
Copy link
Collaborator

@RohitR311 RohitR311 commented Nov 6, 2025

What this PR does?

  1. Adds a no new items check to detect if new items are being added and accordingly exits if not for Load More.

Fixes: #868

Summary by CodeRabbit

  • Performance
    • Pagination now terminates automatically after detecting no new items across multiple consecutive attempts, reducing unnecessary page loads and improving app responsiveness.
    • Termination logic enhanced and consistently applied across all pagination methods.

@coderabbitai
Copy link

coderabbitai bot commented Nov 6, 2025

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main fix: addressing an endless loop issue in pagination button clicking, which aligns with the core changeset.
Linked Issues check ✅ Passed The PR implements a 'no new items' detection mechanism that directly addresses issue #868 by stopping pagination when no new items are detected across multiple attempts.
Out of Scope Changes check ✅ Passed All changes are scoped to the pagination loop termination logic in interpret.ts, directly addressing the endless loop bug without introducing unrelated modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch pag-limiter

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8489f95 and deb2ae6.

📒 Files selected for processing (1)
  • maxun-core/src/interpret.ts (2 hunks)
🔇 Additional comments (2)
maxun-core/src/interpret.ts (2)

1249-1251: LGTM! Clean initialization of "no new items" detection.

The variables are correctly initialized before the loop:

  • previousResultCount captures the baseline after the initial scrape
  • noNewItemsCounter starts at zero
  • MAX_NO_NEW_ITEMS constant makes the threshold configurable and self-documenting

1335-1349: LGTM! Solid implementation of the "no new items" termination policy.

The logic correctly detects when pagination stops yielding new items:

  • Compares current item count against the previous count after each scrape
  • Increments the counter only when no progress is made (currentResultCount <= previousResultCount)
  • Resets the counter whenever new items are added, avoiding false positives
  • Stops after 5 consecutive failed attempts

The approach is robust because it directly measures what matters (new unique items) rather than relying on indirect signals like DOM height changes.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@RohitR311 RohitR311 changed the title fix: run stuck in endless loop of clicking on pagination buttons fix(maxus-core): run stuck in endless loop of clicking on pagination buttons Nov 6, 2025
@RohitR311 RohitR311 changed the title fix(maxus-core): run stuck in endless loop of clicking on pagination buttons fix(maxun-core): run stuck in endless loop of clicking on pagination buttons Nov 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Run stuck in endless loop of clicking on pagination buttons

3 participants