shlomiassaf / ngrid

A angular grid for the enterprise

Home Page:https://shlomiassaf.github.io/ngrid

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pbl-ngrid throwing error when changing pages on Angular project.

pasaku opened this issue · comments

Current error message showing is this while changing pages:

TypeError: Cannot read properties of undefined (reading 'prev' ... pebula-ngrid.js:4164

On line 4167, could you please add an Elvis Operator here before 'prev' and 'current':

this.focusChanged = this.focusChanged$
            .pipe(buffer(this.focusChanged$.pipe(debounceTime(0, asapScheduler))), map(events => ({ prev: events[0]?.prev, curr: events[events.length - 1]?.curr })));

#angular12

commented

bump, I have this issue too.
Thanks in advance.

commented

Ok after months with no response from devs, I managed to monkey patch it till they fix it.
Solution:

// Temporary fix for error: reading property of undefined, "prev"
setTimeout(() => {
      const originalDestroy = this.table._extApi.contextApi.destroy;
      this.table._extApi.contextApi.destroy = () => {
        try {
          originalDestroy();
        } catch {}
      };
    }, 1);