decap-cms icon indicating copy to clipboard operation
decap-cms copied to clipboard

feat: add collection size limit feature

Open aannoo opened this issue 8 months ago • 2 comments

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

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

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

aannoo avatar Apr 08 '25 18:04 aannoo

Any updates on this? Needed exactly this feature 😅

PrashantGyawali avatar Jul 14 '25 18:07 PrashantGyawali

@aannoo it's been a while. Are you still interested in merging this PR? What do you think about the possible overrides that @demshy mentioned?

I think we should restrict those, or at least provide a warning in these instances.

martinjagodic avatar Oct 16 '25 09:10 martinjagodic