Skip to content

Fix/localizations-not-populated#58

Open
NEDDL wants to merge 47 commits into
Barelydead:mainfrom
NEDDL:fix/localizations-not-populated
Open

Fix/localizations-not-populated#58
NEDDL wants to merge 47 commits into
Barelydead:mainfrom
NEDDL:fix/localizations-not-populated

Conversation

@NEDDL
Copy link
Copy Markdown

@NEDDL NEDDL commented Mar 27, 2026

Self-referential relations (localizations) were being skipped because
the model's collectionName was already in the ignore list by the time
the localizations key was reached. Handle localizations before the
ignore check and populate it shallowly (true) to avoid infinite recursion.

Closes #21

NEDDL and others added 30 commits September 6, 2024 17:31
fix issue with population of fields with the same names
adapt nodejs engine requirements to @strapi/strapi
chore(package.json): allow node 24
- Register pLevel with contentAPI.addQueryParams for strict mode compat
- Add api:: and /api/ guards to lifecycle subscriber
- Read pLevel from ctx.query as fallback
- Fix parseInt on depth value
- Fix skipCreatorFields plugin name in helpers

Closes #14, closes #15
- Replace lodash merge with deepAssign so objects win over booleans in dynamic zone population
- Skip private fields during population
- Propagate ignore list into component and dynamiczone recursive calls (bug fix)
- Add pIgnore query param to let callers exclude specific fields

Closes #5, closes #9
- Add lodash as explicit dependency (v4.17.23)
- Simplify pIgnore schema to z.string() only
- Parse comma-separated pIgnore strings in bootstrap (e.g. "field1,field2")
- Add node_modules to .gitignore
strapi.contentAPI.addQueryParams was introduced in 5.37. Guard the call
so the plugin loads cleanly on older versions while still registering the
params on 5.37+.
NEDDL and others added 17 commits March 17, 2026 23:07
Components with no media/relation/component fields return `true` from
getFullPopulateObject (nothing to deep-populate). The dynamic zone
reducer was treating `true` as "skip", so those components were omitted
from the `on` object and dropped from the API response entirely.

Only skip `undefined` (the admin::user/skipCreatorFields case).

Fixes #17
When maxDepth <= 1, getFullPopulateObject returns `true`. Accessing
`.populate` on it yields `undefined`, causing Strapi to fall back to
schema defaults for scalar fields instead of returning real stored values.

Skip the assignment entirely when the result is not a populate object.

Closes #13
…ss-branch contamination

The ignore array was passed by reference to all recursive calls, so any
model visited in one branch would be added to the shared list and then
skipped by the relation pre-check in all sibling branches. With pLevel=5
this caused deep relations that appear in more than one place in the
schema to silently disappear from the response.

Fix by spreading the array ([...ignore]) at every recursive call site so
each branch inherits only its own ancestors, not models visited in
unrelated branches. Circular/self-reference prevention and user-specified
pIgnore entries are unaffected.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
refactor: replace lodash isEmpty with native JS, remove dependency
fix: deep relations silently missing when same model appears in multiple schema paths
Self-referential relations (localizations) were being skipped because
the model's collectionName was already in the ignore list by the time
the localizations key was reached. Handle localizations before the
ignore check and populate it shallowly (true) to avoid infinite recursion.

Closes #21

Made-with: Cursor
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.

6 participants