Frontmatter
| id | 6933 |
| title | Enhance Neo.data.Record for Granular Change Notification |
| state | Closed |
| labels | enhancement |
| assignees | [] |
| createdAt | Jul 1, 2025, 9:54 PM |
| updatedAt | Oct 23, 2025, 12:56 AM |
| githubUrl | https://github.com/neomjs/neo/issues/6933 |
| author | tobiu |
| commentsCount | 1 |
| parentIssue | null |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Jul 1, 2025, 10:32 PM |
Enhance Neo.data.Record for Granular Change Notification

Clarification on Solution / Current Implementation Status:
The new notifyChange() method within the Record class (created by RecordFactory) provides the necessary internal hook for granular field change notifications. This method, when called (e.g., by record.set()), executes instance.setRecordFields() and crucially returns the param object containing details about the change ({fields, model, record, silent}).
External entities, such as Neo.state.Provider, can leverage this by using Neo.util.Function.createSequence() to attach a function to the Record instance's notifyChange method. This attached function would execute after the record's fields have been updated and would receive the param object, providing direct access to the record and the changedFields array.
This approach allows for granular record-level change detection without requiring the Neo.data.Record class to implement a full Observable mixin, thus preserving its lightweight nature. The foundation for granular change notification at the record level appears to be in place through the notifyChange() method's design and its interaction with createSequence().
Is your feature request related to a problem? Please describe.
Neo.data.Recordinstances, while holding data, do not currently provide a direct, granular mechanism for external entities to subscribe to changes of their individual fields. Changes are primarily propagated via the owningNeo.data.Store'smutateevent, which is a broader, collection-level notification. This makes it challenging for components or state providers to react specifically to changes within a record's properties without manual workarounds.Describe the solution you'd like Introduce a lightweight, internal mechanism within
Neo.data.Recordto signal when its individual fields change. This could be a new internal event (e.g.,fieldChange) or a dedicated callback that gets triggered by methods likeset()orsetRecordFields()when a field's value is modified. The goal is to provide a granular, record-level notification of changes, while maintaining the record's lightweight nature.Describe alternatives you've considered Currently, developers must rely on listening to the
mutateevent on theNeo.data.Storeand then manually inspecting theaddedItemsandremovedItemsto infer changes, or implement custom logic to track record field changes. This is inefficient and adds significant boilerplate, especially when only a specific field's change is relevant.Additional context This enhancement is a prerequisite for enabling more seamless and idiomatic binding to individual record properties via
Neo.state.Provider(as described in a separate feature request). It is crucial to implement this in a way that does not significantly increase the memory footprint or processing overhead for eachNeo.data.Recordinstance, as records are often used in large quantities within collections.