LearnNewsExamplesServices
Frontmatter
tagName8.6.0
namedata.RecordFactory: performance boost for creating records
publishedAt1/21/2025, 4:03:31 PM
isPrerelease
isDraft

data.RecordFactory: performance boost for creating records

old version:

Screenshot 2025-01-19 at 15 25 04

new version:

Screenshot 2025-01-19 at 15 25 47

While it is definitely not "best practises" to create massive amounts of records inside your UI at once (you would pull ranges from a backend), a framework should handle it as fast as possible.

To get the numbers up this drastically, I needed to move the fields creation outside of the record constructor and into the class generation. The API for records is the same as before, however the internal structure how data gets stored did change.

For nested data, you can change specific leaf nodes without overriding other siblings (it will get merged):

record.set({user: {firstname: 'Tobias'}})

You can also still trigger bulk updates => multiple fields getting into the same update cycle:

record.set({user: {firstname: 'Tobias', lastname: 'Uhlig'}})

You can still use the shortcut around the set() API to change root level fields, but this can no longer work for nested fields directly. Examples:

record.country = 'Germany'; // Internal setter, will trigger a change event like before

// No longer supported!
record.annotations.selected = false; // this shortcut syntax did work in previous versions, but no longer matches the internal structure

// Instead use the API:
record.set({annotations: {selected: false}})

// In case you want a direct field access to trigger the field change event, you can also use this shortcut (outside the API):
record['annotations.selected'] = false;

Records now provide a JSON export:

Screenshot 2025-01-21 at 16 31 17

To see the editing inside an example app: https://neomjs.com/examples/table/nestedRecordFields/index.html