Bug Description
When ui5-table-row elements are removed from the DOM (e.g. because a parent framework re-renders the list with new data), a pending onBeforeRendering call fires on the detached row. At that point this.parentElement is null. The _table getter passes this null to isInstanceOfTable(), which calls createInstanceChecker, which does "isTable" in null — causing an uncaught TypeError.
Root cause
In TableRowBase.js:
get _table() {
const element = this.parentElement; // can be null after detach
return isInstanceOfTable(element) ? element : undefined;
}
In @ui5/webcomponents-base/dist/util/createInstanceChecker.js:
function createChecker(prop) {
return (object) => {
return object !== undefined && prop in object && object[prop] === true;
// ^^^^^^^^^^^^^^^^^^^ null is not guarded — "prop in null" throws
};
}
The in operator throws TypeError if the right-hand operand is null. Only undefined is guarded.
Proposed fix
In createInstanceChecker.js (both dist/util/ and dist/prod/util/):
return object !== undefined && object !== null && prop in object && object[prop] === true;
Or alternatively guard in TableRowBase._table:
get _table() {
const element = this.parentElement;
return element && isInstanceOfTable(element) ? element : undefined;
}
Workaround
Patch node_modules/@ui5/webcomponents-base/dist/util/createInstanceChecker.js with patch-package.
Affected Component
ui5-table-row, ui5-table-header-row
Expected Behaviour
No response
Isolated Example
No response
Steps to Reproduce
- Use ui5-table with Angular (or any framework that re-renders the row list reactively)
- Render a table with rows
- Trigger a data reload that replaces all rows (e.e. search/filter reset)
- The framework destroys the old ui5-table-row elements while UI5's render queue still has a pending onBeforeRendering for them
- TypeError: Cannot use 'in' operator to search for 'isTable' in null is thrown
Log Output, Stack Trace or Screenshots
No response
Priority
High
UI5 Web Components Version
2.23.1
Browser
Chrome
Operating System
No response
Additional Context
No response
Organization
No response
Declaration
Bug Description
When ui5-table-row elements are removed from the DOM (e.g. because a parent framework re-renders the list with new data), a pending onBeforeRendering call fires on the detached row. At that point this.parentElement is null. The _table getter passes this null to isInstanceOfTable(), which calls createInstanceChecker, which does "isTable" in null — causing an uncaught TypeError.
Root cause
In TableRowBase.js:
In @ui5/webcomponents-base/dist/util/createInstanceChecker.js:
The in operator throws TypeError if the right-hand operand is null. Only undefined is guarded.
Proposed fix
In createInstanceChecker.js (both dist/util/ and dist/prod/util/):
return object !== undefined && object !== null && prop in object && object[prop] === true;
Or alternatively guard in TableRowBase._table:
Workaround
Patch node_modules/@ui5/webcomponents-base/dist/util/createInstanceChecker.js with patch-package.
Affected Component
ui5-table-row, ui5-table-header-row
Expected Behaviour
No response
Isolated Example
No response
Steps to Reproduce
Log Output, Stack Trace or Screenshots
No response
Priority
High
UI5 Web Components Version
2.23.1
Browser
Chrome
Operating System
No response
Additional Context
No response
Organization
No response
Declaration