Skip to content

Enhancement/paginate lists#201

Open
jonjennings wants to merge 7 commits intomailchimp:developfrom
jonjennings:enhancement/paginate-lists
Open

Enhancement/paginate lists#201
jonjennings wants to merge 7 commits intomailchimp:developfrom
jonjennings:enhancement/paginate-lists

Conversation

@jonjennings
Copy link
Copy Markdown

Description of the Change

Prior to this PR, accounts with >100 lists were hard-capped — only 100 lists were fetched via the API and only 100 appeared in the dropdown in the admin UI

Now the dropdowns in the admin UI and the block editor display 50 lists at a time with prev/next controls to fetch and display additional lists (number displayed is controlled by MCSF_LISTS_PER_PAGE)
[Actually the Mailchimp block has to fetch all lists up-front but mimics the admin UI with pagination across dropdowns of 50 lists]

The API get() method now accepts an $offset parameter enabling fetching lists in blocks

When the plugin needs to fetch ALL lists, it issues multiple API calls in batches of 100 (controlled by MCSF_LISTS_API_FETCH_LIMIT)

Admin list section UI:
image

Mailchimp Block list selection UI:
image

Closes #186 - "Plugin limited to 100 lists"

How to test the Change

  1. Connect plugin to a Mailchimp account with >100 lists

Mailchimp form:
2. Navigate to the site's admin page at /wp-admin/admin.php?page=mailchimp_sf_options
3. Observe only 50 lists shown in list selection dropdown and text underneath reads "1-50 of xxx lists"
4. Click next/prev buttons as appropriate and observe status text changes and contents of dropdown list changes

Block editor:
5. Create a page
6. Add a Mailchimp block
7. Observe "select a list" dropdown in block settings contains only 50 lists
8. Functionality and navigation duplicates the Mailchimp form UI

Changelog Entry

Fixed - Enhancement/paginate lists

Credits

Props @jonjennings

Checklist:

  • I agree to follow this project's Code of Conduct.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests pass.

@vikrampm1 vikrampm1 requested a review from iamdharmesh March 16, 2026 06:04
@vikrampm1 vikrampm1 added this to the Future Release milestone Mar 16, 2026
@iamdharmesh
Copy link
Copy Markdown
Collaborator

Thanks a lot for the PR, @jonjennings. I will try to look into this next week. I really appreciate your contribution here. Thank you!

@iamdharmesh
Copy link
Copy Markdown
Collaborator

Hi @jonjennings,

Thanks a lot for your contribution, and apologies for the delay. The PR looks really solid.

We’ve been discussing different approaches internally, and the general consensus is that only a small number of users are likely to have 100+ lists. Instead of introducing changes for everyone, one idea is to add a filter that allows users to adjust the page limit as needed for example, setting it to 150 in your case. This keeps things lightweight while still solving the problem for those who need it.

If we see more demand in the future, we can also consider enhancing the select dropdown into a searchable one.

What are your thoughts? Thanks. cc: @builtbytay

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.

Plugin limited to 100 lists

3 participants