Frontmatter
| id | 6650 |
| title | neo/examples/stateProvider/Table.mjs invokes onStoreLoad _twice_ ?? |
| state | Closed |
| labels | bug |
| assignees | tobiu |
| createdAt | Apr 15, 2025, 10:09 AM |
| updatedAt | Apr 15, 2025, 6:38 PM |
| githubUrl | https://github.com/neomjs/neo/issues/6650 |
| author | gplanansky |
| commentsCount | 2 |
| parentIssue | null |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Apr 15, 2025, 10:51 AM |
neo/examples/stateProvider/Table.mjs invokes onStoreLoad twice ??
tobiu assigned to @tobiu on Apr 15, 2025, 10:48 AM

tobiu
Apr 15, 2025, 10:51 AM
Hi @gplanansky,
Obviously it should not happen, although the vdom engine will catch it => no duplicate DOM manipulations.
I changed the store internally a bit: https://github.com/neomjs/neo/blob/dev/src/data/Store.mjs#L435
onConstructed()now triggers a slightly delayed load event, in case there is data.- so,
beforeSetStore()inside the table container no longer needs to to this as well. - double-checked the grid, and it was already adjusted there.
tobiu closed this issue on Apr 15, 2025, 10:51 AM

gplanansky
Apr 15, 2025, 6:38 PM
Thanks. Debugging a data app's event-triggered reload logic, which I use a lot, gets confounded if core store / table have their own bug. I could see the trace going through beforeSetStore, but didn't sort it out.
Running neo/examples/stateProvider/Table.mjs invokes onStoreLoad twice, hence createViewData is invoked twice. Shouldn't this only load once?
https://github.com/neomjs/neo/blob/42029c4405b6a5c1189fb5ad641672db584eccc1c/src/table/Container.mjs#L476
onStoreLoad(data) { let me = this; if (me.rendered) { me.createViewData();https://github.com/neomjs/neo/blob/42029c4405b6a5c1189fb5ad641672db584eccc1/src/table/View.mjs#L325
createViewData() { let me = this, {selectedRows, store} = me, countRecords = store.getCount(), i = 0, rows = []; for (; i < countRecords; i++) { ///////// this rows.push(me.createRow({record: store.items[i], rowIndex: i})) }