Web: avoid error resizing the tasks table

The tasks table resize function is called via `this.$nextTick()`, which
means that the component can actually already be unmounted by the time
the actual function call is performed. This is now detected & handled.
This commit is contained in:
Sybren A. Stüvel 2022-05-31 14:56:13 +02:00
parent 885911a06e
commit cd35e3a5cb

View File

@ -200,6 +200,13 @@ export default {
const table = this.tabulator.element; const table = this.tabulator.element;
const tableContainer = table.parentElement; const tableContainer = table.parentElement;
const outerContainer = tableContainer.parentElement; const outerContainer = tableContainer.parentElement;
if (!outerContainer) {
// This can happen when the component was removed before the function is
// called. This is possible due to the use of Vue's `nextTick()`
// function.
return;
}
const availableHeight = outerContainer.clientHeight - 12; // TODO: figure out where the -12 comes from. const availableHeight = outerContainer.clientHeight - 12; // TODO: figure out where the -12 comes from.
if (tableContainer.offsetParent != tableContainer.parentElement) { if (tableContainer.offsetParent != tableContainer.parentElement) {