Frontmatter
| id | 8095 |
| title | Optimize Store.initRecord to avoid redundant get() calls |
| state | Closed |
| labels | enhancementai |
| assignees | tobiu |
| createdAt | Dec 12, 2025, 1:23 PM |
| updatedAt | Dec 12, 2025, 1:38 PM |
| githubUrl | https://github.com/neomjs/neo/issues/8095 |
| author | tobiu |
| commentsCount | 0 |
| parentIssue | null |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Dec 12, 2025, 1:38 PM |
The
add()andinsert()methods inNeo.data.Storenow default to returning record instances (init=true). This meansinitRecord()is called more frequently with items that might already be record instances.Currently,
initRecord()callsthis.get(), which internally checks if the item is a record. To avoid this unnecessary method call and lookup, we should add an explicit check ininitRecord():initRecord(data) { if (RecordFactory.isRecord(data)) { return data; } return this.get(data[this.getKeyProperty()]) }This optimizes the common path where records are already present.