Skip to content

Conversation

@cyp3rius
Copy link
Contributor

@cyp3rius cyp3rius commented Nov 28, 2025

Pull Request

📝 Description

Provides support for i18n and different ways of calling the loader.

🔄 Changes

  • Custom ID Generator - Added idGenerator option to generate collection IDs from custom fields (e.g., slugs) instead of documentId
  • Multiple Collections from Same Endpoint - Added collectionName option to create multiple collections from the same Strapi content type with different configurations
  • Locale Support - Added locale option (string or array) to fetch single or multiple language versions with automatic locale-prefixed IDs

🧪 Testing

// Custom ID from slug
strapiLoader('pages', { 
  idGenerator: (data) => data.slug 
})
// Multiple collections from same endpoint
strapiLoader('pages', { 
  collectionName: 'pagesEN', 
  locale: 'en' 
})
// Multiple locales in one collection
strapiLoader('pages', { 
  locale: ['en', 'de', 'fr'] 
})

✅ Checklist

  • I have read and followed the Contributing Guidelines
  • My changes follow the code style of this project
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the documentation accordingly
  • I have added my changes to the CHANGELOG.md

🔗 Related Issues

Closes #17, #18, #19

@codecov-commenter
Copy link

codecov-commenter commented Nov 28, 2025

Codecov Report

❌ Patch coverage is 95.77465% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.63%. Comparing base (abc3ca1) to head (0825f15).

Files with missing lines Patch % Lines
src/utils/strapi.ts 50.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #20      +/-   ##
==========================================
+ Coverage   91.73%   93.63%   +1.90%     
==========================================
  Files           3        3              
  Lines         230      283      +53     
  Branches       78       94      +16     
==========================================
+ Hits          211      265      +54     
+ Misses         19       18       -1     
Flag Coverage Δ
unittest 93.63% <95.77%> (+1.90%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

[FEATURE] Possibility to change collection items ID source

2 participants