Hello,
We are upgrading Handsontable from 8.4.0 to 13.1.0.
Our app is using Angular framework (version 16).
With the new package the exception “TypeError: Cannot read properties of undefined (reading ‘isDestroyed’)” is being thrown in various places.
I have tracked down issue to the HotTableRegisterer().getInstance(id) method – it does throw that exception.
Note: there is no such issue when using version 8.4 of Handsontable.
Here’s the code which demonstrates an issue.
import { Component } from ‘@angular/core’;
import { OnInit } from ‘@angular/core’;
import { HotTableRegisterer } from ‘@handsontable/angular’;
import Handsontable from ‘handsontable/base’;
class TableItem {
constructor(public uid: number, public name: string, public alias: string) {
}
}
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {
hotID: string = 'hot-317';
tableData: TableItem[] | undefined = [];
constructor() {
// this fails
try { this.getHotInstance(); console.log('getHotInstance(1): OK'); } catch(x) { console.error('Error(1):', x); }
}
ngOnInit(): void {
// this fails
try { this.getHotInstance(); console.log('getHotInstance(2): OK'); } catch(x) { console.error('Error(2):', x); }
// only this succeeds
setTimeout(() => {
try { this.getHotInstance(); console.log('getHotInstance(3): OK'); } catch(x) { console.error('Error(3):', x); }
});
}
public getHotInstance(): Handsontable {
return new HotTableRegisterer().getInstance(this.hotID);
}
}