Skip to content

feat: add collection size limit feature #7451

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

aannoo
Copy link

@aannoo aannoo commented Apr 8, 2025

Summary

This PR adds a collection size limit feature to Decap CMS, allowing administrators to restrict the number of entries that can be created in a folder collection. This is particularly useful for managing content growth and preventing accidental overpopulation of collections.

The implementation:

  • Adds an optional limit field to the collection configuration schema
  • Introduces a new selectCanCreateNewEntry selector to check if new entries can be created
  • Updates the Collection component to respect collection limits
  • Includes comprehensive tests for the new functionality

Test plan

The changes have been thoroughly tested:

  1. Unit Tests:
npm run test

All tests pass, including:

  • Collection component tests
  • Selector tests
  • Type checking
  • Linting
  1. Manual Testing:
  • Created a collection with a limit of 5 entries
  • Verified that the "New Entry" button is disabled after reaching the limit
  • Confirmed that non-folder collections are unaffected
  • Tested edge cases (undefined limit, null limit)

Checklist

  • I have read the contribution guidelines.
  • Code is properly formatted and linted
  • Tests have been added/updated
  • Documentation is updated
  • Changes are backward compatible

🦊 (A fox, seemingly modest, but is actually representing the joy of open source content management for our Git workflow!)

@aannoo aannoo requested a review from a team as a code owner April 8, 2025 18:06
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