Skip to content

fix: show as many snippets per page as Screen Options allows - #616

Open
TallblokeUK wants to merge 3 commits into
core-betafrom
fix/snippets-per-page/core
Open

TallblokeUK wants to merge 3 commits into
core-betafrom
fix/snippets-per-page/core

Conversation

@TallblokeUK

Copy link
Copy Markdown
Contributor

The snippets list could show fewer snippets than the Snippets per page Screen Option allows, and fewer pages than there are snippets.

Changes

  • The manage page now sends as many snippets inline as the user's per-page setting (previously capped at 100). The code_snippets/manage/inline_snippets_limit filter still applies. Code bodies were already left out of the inline data.
  • ListTable takes itemsPerPage and works out the page count, instead of taking totalPages and dividing the items evenly across pages. With 324 snippets at 100 per page, pages now hold 100, 100, 100 and 24 rather than 81 each. PartialDataListTable keeps its own totalPages.
  • If loading the full list fails after the page loads, the list showed only the inline snippets and gave no indication. An error notice now says the list may be incomplete and offers Try again.
  • test_enqueue_omits_snippets_above_inline_limit relied on the test database holding a single snippet; it is replaced by a test that the inline list is cut to the limit.

Verification

  • New Manage_Menu_Assets_Test case: with 110 per page and 120 snippets, 110 are sent inline.
  • Full PHPUnit suite, PHPCS and ESLint pass locally.
  • In a browser with 324 snippets: 100 per page gives four pages of 100/100/100/24; 500 per page with the list request failing shows all 324 and the notice; 100 per page with the request failing shows 100 and the notice; Try again loads the list and clears the notice.

@TallblokeUK TallblokeUK added the run-tests Trigger automated tests label Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run-tests Trigger automated tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant