Frontmatter
| id | 9060 |
| title | Fix: RecordFactory defaultValue prevents mapping execution |
| state | Closed |
| labels | bugaicore |
| assignees | tobiu |
| createdAt | Feb 8, 2026, 11:31 PM |
| updatedAt | Feb 8, 2026, 11:53 PM |
| githubUrl | https://github.com/neomjs/neo/issues/9060 |
| author | tobiu |
| commentsCount | 0 |
| parentIssue | null |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| contentTrust | |
| projected | |
| quarantined | 0 |
| signals | [] |
| blockedBy | [] |
| blocking | [] |
| closedAt | Feb 8, 2026, 11:53 PM |
Neo.data.RecordFactoryhas a logic flaw inassignDefaultValueswheredefaultValueassignment takes precedence overmapping.Current Logic:
if (Object.hasOwn(field, 'defaultValue')) { // ... if (data[fieldName] === undefined) { data[fieldName] = defaultValue; // Assigns default } } else if (field.mapping) { // ELSE IF prevents mapping! // Mapping logic... }Problem: If a field has both
defaultValueandmapping(e.g.{name: 'location', mapping: 'lc', defaultValue: null}), and the raw data contains the mapped key (lc) but not the target key (location):data['location']isundefined.if.nulltodata['location'].else ifblock, so the mapping fromlcnever happens.Solution: The mapping logic must run before the default value check, or they must be decoupled so that mapping can populate the field first, and then the default value fills in only if it remains undefined.