Describe the bug
Grid 생성 시, rowHeight를 'auto' 로 리액트컴포넌트로 생성하여 TUI 그리드를 다이얼로그 상에서 사용.
refreshRowHeight 가 BodyCellComp.prototype.calculateRowHeight 에서 Window.setTimeout 으로 호출됨.
해당 다이얼로그가 클로즈 되어 Virtual Dom 상에서 dispose 되는 시점에 setTimeout 통해 function 이 호출되게 되면서
undefined 엑세스 관련 에러 발생
function refreshRowHeight(store, rowIndex, rowHeight) {
var data = store.data, rowCoords = store.rowCoords, renderState = store.renderState;
var cellHeightMap = renderState.cellHeightMap;
var cellHeights = cellHeightMap[rowIndex];
if (common_1.isUndefined(cellHeights)) {
return;
}
var highestHeight = Object.keys(cellHeights).reduce(function (acc, columnName) { return Math.max(acc, cellHeights[columnName]); }, -1);
if (rowHeight !== highestHeight) {
data.rawData[rowIndex]._attributes.height = highestHeight; //<--- 해당 부분의 data.rawData 는 undefined 이고 data.rawData[rowIndex] 는 undefined 가 됨. 따라서 undefined 에서 _attributes 에 대한 Unhandled Runtime Error 가 발생.
rowCoords.heights[rowIndex] = highestHeight;
observable_1.notify(rowCoords, 'heights');
}
}
Expected behavior
cellHeights 처럼 data.rawData[rowIndex]._attributes.height 에 대한 undefined 체크 로직 필요
//expected
function refreshRowHeight(store, rowIndex, rowHeight) {
var data = store.data, rowCoords = store.rowCoords, renderState = store.renderState;
var cellHeightMap = renderState.cellHeightMap;
var cellHeights = cellHeightMap[rowIndex];
if (common_1.isUndefined(cellHeights)) {
return;
}
var rowData= data.rawData[rowIndex];
if (common_1.isUndefined(rowData)) {
return;
}
var highestHeight = Object.keys(cellHeights).reduce(function (acc, columnName) { return Math.max(acc, cellHeights[columnName]); }, -1);
if (rowHeight !== highestHeight) {
data.rawData[rowIndex]._attributes.height = highestHeight;
rowCoords.heights[rowIndex] = highestHeight;
observable_1.notify(rowCoords, 'heights');
}
}
Describe the bug Grid 생성 시, rowHeight를 'auto' 로 리액트컴포넌트로 생성하여 TUI 그리드를 다이얼로그 상에서 사용. refreshRowHeight 가 BodyCellComp.prototype.calculateRowHeight 에서 Window.setTimeout 으로 호출됨. 해당 다이얼로그가 클로즈 되어 Virtual Dom 상에서 dispose 되는 시점에 setTimeout 통해 function 이 호출되게 되면서 undefined 엑세스 관련 에러 발생
Expected behavior cellHeights 처럼 data.rawData[rowIndex]._attributes.height 에 대한 undefined 체크 로직 필요