Skip to content

Commit 37e7035

Browse files
refactor(deep-populate): consolidate warning log conditions
1 parent 8e18231 commit 37e7035

File tree

1 file changed

+6
-9
lines changed
  • server/src/services/deep-populate

1 file changed

+6
-9
lines changed

server/src/services/deep-populate/index.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,12 @@ async function _populateComponent<TContentType extends UID.ContentType, TSchema
2828
const componentLookup = lookup.length === 0 ? [attrName] : [...lookup, inDynamicZone ? "on" : "populate", attrName]
2929

3030
if (strapi.getModel(schema) === undefined) {
31-
if (inDynamicZone) {
32-
const dynamicZoneName = lookup[lookup.length - 1]
33-
log.warn(
34-
`[Plugin: Deep Populate] The dynamic zone '${dynamicZoneName}' is referencing a non-existing component '${schema}'. You should fix this.`,
35-
{ lookup },
36-
)
37-
} else {
38-
log.warn(`[Plugin: Deep Populate] Could not find component: '${schema}'`)
39-
}
31+
log.warn(
32+
inDynamicZone
33+
? `The dynamic zone '${lookup[lookup.length - 1]}' is referencing a non-existing component '${schema}'. You should fix this.`
34+
: `Could not find component: '${schema}'`,
35+
{ lookup },
36+
)
4037
return true
4138
}
4239

0 commit comments

Comments
 (0)