Fix/localizations-not-populated#58
Open
NEDDL wants to merge 47 commits into
Open
Conversation
fix issue with population of fields with the same names
adapt nodejs engine requirements to @strapi/strapi
chore(package.json): allow node 24
fix self-recursion
- 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+.
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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