Frontmatter
| id | 3196 |
| title | data.RecordFactory: createRecord() => smarter matching to model instances |
| state | Closed |
| labels | bug |
| assignees | tobiu |
| createdAt | Jun 25, 2022, 2:12 PM |
| updatedAt | Jun 25, 2022, 2:14 PM |
| githubUrl | https://github.com/neomjs/neo/issues/3196 |
| author | tobiu |
| commentsCount | 0 |
| parentIssue | null |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Jun 25, 2022, 2:14 PM |
the current logic:
createRecord(model, config) { let recordClass = Neo.ns(this.recordNamespace + model.className); if (!recordClass) { recordClass = this.createRecordClass(model); } return new recordClass(config); }has a problem: each
data.Storewill create one instance ofdata.Model, which contains thestoreId. In case multiple stores are using the same model class, therecordClasswill just use the first created model instance. This can affect listeners, pointing to the wrong stores.to solve this, we need to add the model.id into the record class namespace.