Skip to content

neo/examples/stateProvider/Table.mjs invokes onStoreLoad _twice_ ?? #6650

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
gplanansky opened this issue Apr 15, 2025 · 2 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@gplanansky
Copy link
Contributor

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();

createViewData() {

    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}))
        }
@gplanansky gplanansky added the bug Something isn't working label Apr 15, 2025
@tobiu tobiu self-assigned this Apr 15, 2025
@tobiu
Copy link
Collaborator

tobiu commented Apr 15, 2025

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 tobiu closed this as completed Apr 15, 2025
tobiu added a commit that referenced this issue Apr 15, 2025
@gplanansky
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants