mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 21:09:43 +00:00
ListView can warn when failing to measure rows because the list was not in the DOM (#208204)
After debugging this for the 100th time, I will make the 101st time easier to troubleshoot. I don't think there are any reasonable cases where the list row height would actually be 0, so I think this avoids unnecessary calls to isAncestor
This commit is contained in:
parent
385ad93dd6
commit
b45774692c
|
@ -4,7 +4,7 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { DataTransfers, IDragAndDropData } from 'vs/base/browser/dnd';
|
||||
import { $, addDisposableListener, animate, Dimension, getContentHeight, getContentWidth, getTopLeftOffset, getWindow, scheduleAtNextAnimationFrame } from 'vs/base/browser/dom';
|
||||
import { $, addDisposableListener, animate, Dimension, getContentHeight, getContentWidth, getTopLeftOffset, getWindow, isAncestor, scheduleAtNextAnimationFrame } from 'vs/base/browser/dom';
|
||||
import { DomEmitter } from 'vs/base/browser/event';
|
||||
import { IMouseWheelEvent } from 'vs/base/browser/mouseEvent';
|
||||
import { EventType as TouchEventType, Gesture, GestureEvent } from 'vs/base/browser/touch';
|
||||
|
@ -1517,6 +1517,9 @@ export class ListView<T> implements IListView<T> {
|
|||
if (item.row) {
|
||||
item.row.domNode.style.height = '';
|
||||
item.size = item.row.domNode.offsetHeight;
|
||||
if (item.size === 0 && !isAncestor(item.row.domNode, getWindow(item.row.domNode).document.body)) {
|
||||
console.warn('Measuring item node that is not in DOM! Add ListView to the DOM before measuring row height!');
|
||||
}
|
||||
item.lastDynamicHeightWidth = this.renderWidth;
|
||||
return item.size - size;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue