Commit ac9ac1c
* fix: preserve relation and locale data in lifecycle hooks (#1040)
Fixes an issue where lifecycle results only contained relation counts instead of full relation objects, and locale data was not being properly passed to getEntry. The fix ensures:
- Complete entries with full relations are fetched instead of using lifecycle results with counts
- Locale from lifecycle result is passed to maintain i18n consistency
- Status 'published' is always passed to ensure only published content is indexed
- Added comprehensive tests for the fix
* fix: missing empty result guard
* docs: add comment explaining Strapi 5 publishedAt behavior
Added clarifying comment that publishedAt is always set in Strapi 5
even when draftAndPublish is disabled, with link to migration docs.
* refactor: auto format code
* fix: typo in content-types.js
* refactor: cleanup getEntries' locale
In strapi v5, locale is part of strapi core right now, so checking locale is not needed.
More information: https://docs.strapi.io/cms/migration/v4-to-v5/breaking-changes/i18n-content-manager-locale
* refactor: extract query options into separate variable for cleaner code
Simplify strapi.documents().findOne() call by extracting query parameters
into a queryOptions object
* Add 'publishedAt' to mock entries in tests
Updated mock entries to include 'publishedAt' attribute for Strapi v5 compatibility.
* Wrap fetchedEntry in an array for Meilisearch calls
---------
Co-authored-by: Michel Díaz <[email protected]>
1 parent 5e27e17 commit ac9ac1c
File tree
7 files changed
+740
-28
lines changed- server/src
- __tests__
- utils
- services
- content-types
- lifecycle
- meilisearch
7 files changed
+740
-28
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| |||
176 | 177 | | |
177 | 178 | | |
178 | 179 | | |
| 180 | + | |
| 181 | + | |
179 | 182 | | |
180 | 183 | | |
181 | 184 | | |
| |||
203 | 206 | | |
204 | 207 | | |
205 | 208 | | |
| 209 | + | |
| 210 | + | |
206 | 211 | | |
207 | 212 | | |
208 | 213 | | |
| |||
0 commit comments