Skip to content

fix: read page_length from response so "Load More" advances the page (backport #2850) - #2878

Open
mergify[bot] wants to merge 2 commits into
main-hotfixfrom
mergify/bp/main-hotfix/pr-2850
Open

mergify[bot] wants to merge 2 commits into
main-hotfixfrom
mergify/bp/main-hotfix/pr-2850

Conversation

@mergify

@mergify mergify Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

closes #2835

What was broken

On a freshly opened list view, the first Load More click did nothing visible. The request was actually failing with:

FrappeTypeError: Argument 'page_length' in 'crm.api.doc.get_data' should be of type 'int' but got 'NoneType' instead.

pageLength and pageLengthCount in ViewControls.vue are read from the previous response. On a cold load there is none, so both are undefined. The first request omits the key (server falls back to 20), but undefined is what gets stored in defaultParams. Load More then computes undefined + undefined = NaN, which serialises to null, and get_data rejects it. Rows stay as they were, so it looked like a Refresh.

The same undefined also leaked into the export URL as &page_length=undefined.

What this fixes

Frontend (ViewControls.vue)

  • Default pageLength / pageLengthCount to 20 (the get_data default) when there is no response yet, so the first request always carries a real integer and Load More goes 20 -> 40 -> 60.
  • onSuccess now stores page_length / page_length_count from the response instead of the outgoing params, so defaultParams reflects what the server actually used.

Backend (crm/api/doc.py)

  • In the kanban branch, the per-column loop reassigned the page_length argument (page_length = kc.get("page_length", 20)), so the response echoed the last column's page size instead of the requested one. Renamed it to column_page_length. This is a pre-existing leak - it already affected the pageLength computed when switching kanban -> list after loading more in a column - and it is required now that the frontend trusts the echoed value.

This is an automatic backport of pull request #2850 done by [Mergify](https://mergify.com).

…tching

(cherry picked from commit 7685736)

# Conflicts:
#	crm/api/doc.py
(cherry picked from commit 9b6fb73)

# Conflicts:
#	crm/api/doc.py
@mergify

mergify Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor Author

Cherry-pick of 7685736 has failed:

On branch mergify/bp/main-hotfix/pr-2850
Your branch is up to date with 'origin/main-hotfix'.

You are currently cherry-picking commit 7685736.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	new file:   crm/tests/test_list_page_length.py
	new file:   e2e/tests/list-pagination.spec.ts
	modified:   frontend/src/components/ViewControls.vue

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   crm/api/doc.py

Cherry-pick of 9b6fb73 has failed:

On branch mergify/bp/main-hotfix/pr-2850
Your branch is ahead of 'origin/main-hotfix' by 1 commit.
  (use "git push" to publish your local commits)

You are currently cherry-picking commit 9b6fb73.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   crm/tests/test_list_page_length.py
	modified:   frontend/src/components/ViewControls.vue

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   crm/api/doc.py

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@mergify mergify Bot removed the conflicts label Sep 21, 2026
@mergify

mergify Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor Author

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

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.

1 participant