Refactor Neo.data.Store to default add() and insert() to eager record initialization (init=true) and enhance JSDoc.
Reasoning (DX):
The previous default behavior of add() returning raw data objects (lazy loading) was a common "gotcha" for developers, requiring a second step (store.get(id)) to obtain a usable Model instance.
By changing the default init parameter to true, store.add(data) now returns fully instantiated records by default, which is the expected behavior in most standard use cases.
Changes:
Neo.data.Store:
add(item, init=true): Defaults to eager initialization.
insert(index, item, init=true): Defaults to eager initialization.
- Internal usages (
afterSetData, sort) explicitly use init=false to preserve performance for bulk operations.
examples/grid/bigData/MainStore.mjs:
- Explicitly uses
init=false ("Turbo Mode") to ensure the 100k row benchmark continues to use the performant lazy-loading chunking mechanism.
Documentation Enhancement:
The JSDoc for add and insert in Neo.data.Store needs to be significantly enhanced to clearly explain:
- The difference between
init=true (eager, returns Records) and init=false (lazy, returns raw data / count).
- The performance implications (use
init=false for bulk loading).
- The return type variations (
Number vs Array).
Refactor
Neo.data.Storeto defaultadd()andinsert()to eager record initialization (init=true) and enhance JSDoc.Reasoning (DX): The previous default behavior of
add()returning raw data objects (lazy loading) was a common "gotcha" for developers, requiring a second step (store.get(id)) to obtain a usableModelinstance. By changing the defaultinitparameter totrue,store.add(data)now returns fully instantiated records by default, which is the expected behavior in most standard use cases.Changes:
Neo.data.Store:add(item, init=true): Defaults to eager initialization.insert(index, item, init=true): Defaults to eager initialization.afterSetData,sort) explicitly useinit=falseto preserve performance for bulk operations.examples/grid/bigData/MainStore.mjs:init=false("Turbo Mode") to ensure the 100k row benchmark continues to use the performant lazy-loading chunking mechanism.Documentation Enhancement: The JSDoc for
addandinsertinNeo.data.Storeneeds to be significantly enhanced to clearly explain:init=true(eager, returns Records) andinit=false(lazy, returns raw data / count).init=falsefor bulk loading).NumbervsArray).