Skip to content

Commit a71be1d

Browse files
committed
Data: Implement Lazy Record Instantiation for Stores #7185
1 parent e76ed91 commit a71be1d

27 files changed

Lines changed: 153 additions & 48 deletions

File tree

apps/finance/view/ViewportController.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class ViewportController extends Controller {
3535
companiesStore = me.getStore('companies'),
3636
items = [];
3737

38-
companiesStore.items.forEach(record => {
38+
companiesStore.forEach(record => {
3939
items.push({
4040
symbol: record.symbol,
4141
value : Math.random() * 1000

apps/form/view/SideNavList.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class SideNavList extends List {
8484
onStoreLoad() {
8585
let maxIndex = -1;
8686

87-
this.store.items.forEach(record => {
87+
this.store.forEach(record => {
8888
if (!record.isHeader) {
8989
maxIndex++
9090
}

apps/realworld2/view/article/PreviewList.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class PreviewList extends List {
3333

3434
me.vdom.cn = [];
3535

36-
me.store.items.forEach(item => {
36+
me.store.forEach(item => {
3737
listItem = Neo.create({
3838
module : PreviewComponent,
3939
parentId: me.id,

docs/app/view/classdetails/MainContainerController.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class MainContainerController extends Component {
3737
countProtecteds = 0,
3838
countStatics = 0;
3939

40-
store.items.forEach(item => {
40+
store.forEach(item => {
4141
if (item.kind === 'function') {
4242
countMethods++
4343
} else if (item.kind === 'member') {

docs/app/view/classdetails/MembersList.mjs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ class MembersList extends Base {
128128
* @returns {Object} vdom
129129
*/
130130
applyConfigsHeader(store, vdom) {
131-
if (store.items[0]?.kind === 'member') {
131+
if (store.getAt(0)?.kind === 'member') {
132132
vdom.cn.push({
133133
// scrolling placeholder
134134
}, {
@@ -152,7 +152,7 @@ class MembersList extends Base {
152152
applyEventsHeader(item, index, store, vdom) {
153153
if (
154154
item.kind === 'event' &&
155-
store.items[index -1]?.kind !== 'event'
155+
store.getAt(index -1)?.kind !== 'event'
156156
) {
157157
vdom.cn.push({
158158
// scrolling placeholder
@@ -179,8 +179,8 @@ class MembersList extends Base {
179179
if (
180180
item.kind === 'function' &&
181181
(
182-
!store.items[index -1] || (
183-
store.items[index -1]?.kind !== 'function'
182+
!store.getAt(index -1) || (
183+
store.getAt(index -1)?.kind !== 'function'
184184
)
185185
)
186186
) {
@@ -211,7 +211,7 @@ class MembersList extends Base {
211211
vdom.cn = [];
212212
vdom = me.applyConfigsHeader(me.store, vdom);
213213

214-
me.store.items.forEach((item, index) => {
214+
me.store.forEach((item, index) => {
215215
vdom = me.applyEventsHeader( item, index, me.store, vdom);
216216
vdom = me.applyMethodsHeader(item, index, me.store, vdom);
217217

examples/grid/bigData/MainStore.mjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,15 @@ class MainStore extends Store {
7474

7575
me.model.amountColumns = value;
7676

77-
console.log('Start creating records');
77+
console.log('Start generating data and adding to collection');
7878

7979
if (me.items?.length > 0) {
8080
me.clear()
8181
}
8282

8383
me.add(data);
8484

85-
console.log(`Record creation total time: ${Math.round(performance.now() - start)}ms`)
85+
console.log(`Data generation and collection add total time: ${Math.round(performance.now() - start)}ms`)
8686
}
8787
}
8888

@@ -97,15 +97,15 @@ class MainStore extends Store {
9797
data = me.generateData(value, me.amountColumns),
9898
start = performance.now();
9999

100-
console.log('Start creating records');
100+
console.log('Start generating data and adding to collection');
101101

102102
if (me.items?.length > 0) {
103103
me.clear()
104104
}
105105

106106
me.add(data);
107107

108-
console.log(`Record creation total time: ${Math.round(performance.now() - start)}ms`)
108+
console.log(`Data generation and collection add total time: ${Math.round(performance.now() - start)}ms`)
109109
}
110110

111111
/**

examples/grid/cellEditing/MainContainerStateProvider.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class MainContainerStateProvider extends StateProvider {
4747

4848
// if the main table store is already loaded, the country field renderer had no data
4949
if (mainStore.getCount() > 0) {
50-
mainStore.items.forEach(record => {
50+
mainStore.forEach(record => {
5151
country = record.country;
5252

5353
// hack resetting the current value to get a new record change

examples/grid/nestedRecordFields/EditUserDialog.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ class EditUserDialog extends Dialog {
163163
me.record.set({annotations: {selected: false}})
164164
} else {
165165
// Assuming we want to support a single row selection
166-
store.items.forEach(record => {
166+
store.forEach(record => {
167167
record.set({annotations: {
168168
selected: record === me.record ? data.value : false
169169
}})

examples/grid/nestedRecordFields/ViewportController.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class ViewportController extends Component {
7171

7272
// if the main table store is already loaded, the country field renderer had no data
7373
if (mainStore.getCount() > 0) {
74-
mainStore.items.forEach(record => {
74+
mainStore.forEach(record => {
7575
country = record.country;
7676

7777
// hack resetting the current value to get a new record change

examples/table/cellEditing/MainContainerStateProvider.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class MainContainerStateProvider extends StateProvider {
4747

4848
// if the main table store is already loaded, the country field renderer had no data
4949
if (mainStore.getCount() > 0) {
50-
mainStore.items.forEach(record => {
50+
mainStore.forEach(record => {
5151
country = record.country;
5252

5353
// hack resetting the current value to get a new record change

0 commit comments

Comments
 (0)