Skip to content

Commit 964d2b8

Browse files
Merge pull request #108 from Four-Lights-NL/fix/component-populate-merging
fix(deep-populate): handle populate merging for all type combinations
2 parents 0ec05c9 + f52c4ce commit 964d2b8

File tree

4 files changed

+24
-7
lines changed

4 files changed

+24
-7
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## [1.13.0] - 2025-11-20
4+
5+
### Fixed
6+
7+
- Merging deeply nested dynamic zones in repeatable components will now be correctly merged ([`c1a4d02`](https://github.com/Four-Lights-NL/strapi-plugin-deep-populate/commit/c1a4d02)) (Thomas Rijpstra)
8+
39
## [1.12.0] - 2025-11-20
410

511
### Fixed
@@ -283,3 +289,5 @@ _:seedling: Initial release._
283289
[1.11.1]: https://github.com/Four-Lights-NL/strapi-plugin-deep-populate/releases/tag/v1.11.1
284290

285291
[1.12.0]: https://github.com/Four-Lights-NL/strapi-plugin-deep-populate/releases/tag/v1.12.0
292+
293+
[1.13.0]: https://github.com/Four-Lights-NL/strapi-plugin-deep-populate/releases/tag/v1.13.0

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "1.12.0",
2+
"version": "1.13.0-rc.0",
33
"keywords": [
44
"strapi",
55
"strapi-plugin",

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

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,19 @@ async function _populateDynamicZone<TContentType extends UID.ContentType>({
7373
})
7474

7575
const currentPopulate = get(resolvedPopulate, [component])
76-
const mergedComponentPopulate =
77-
!currentPopulate && componentPopulate === true
78-
? componentPopulate
79-
: merge({}, currentPopulate, sanitizeObject(componentPopulate))
76+
let mergedComponentPopulate: boolean | unknown | undefined
77+
if (currentPopulate === undefined) {
78+
mergedComponentPopulate =
79+
typeof componentPopulate === "boolean" ? componentPopulate : sanitizeObject(componentPopulate)
80+
} else if (typeof currentPopulate === "boolean") {
81+
mergedComponentPopulate =
82+
typeof componentPopulate === "boolean" ? currentPopulate || componentPopulate : currentPopulate
83+
} else if (typeof currentPopulate === "object") {
84+
mergedComponentPopulate =
85+
typeof componentPopulate === "object"
86+
? merge(currentPopulate, sanitizeObject(componentPopulate))
87+
: currentPopulate
88+
}
8089
set(resolvedPopulate, [component], mergedComponentPopulate) // NOTE: We pass cur as `array` so that the dot notation is used as the key
8190
}
8291

0 commit comments

Comments
 (0)