Skip to content

Commit fbbc5dc

Browse files
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
1 parent 4983e12 commit fbbc5dc

File tree

6 files changed

+690
-15
lines changed

6 files changed

+690
-15
lines changed

server/src/__tests__/content-types.test.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ describe('Tests content types', () => {
2929
expect(contentTypes.sort()).toEqual(
3030
[
3131
'api::about.about',
32+
'api::article.article',
3233
'api::movie.movie',
3334
'api::restaurant.restaurant',
3435
'plugin::users-permissions.user',
@@ -176,6 +177,8 @@ describe('Tests content types', () => {
176177
documentId: '200',
177178
fields: '*',
178179
populate: '*',
180+
locale: undefined,
181+
status: 'published',
179182
})
180183
expect(strapiMock.documents('').findOne).toHaveBeenCalledTimes(1)
181184
expect(entry).toEqual([{ id: 1 }])
@@ -203,6 +206,8 @@ describe('Tests content types', () => {
203206
populate: {
204207
subClass: true,
205208
},
209+
locale: undefined,
210+
status: 'published',
206211
})
207212
expect(strapiMock.documents('').findOne).toHaveBeenCalledTimes(1)
208213
expect(entry).toEqual([{ id: 1 }])

0 commit comments

Comments
 (0)