{"record":{"id":"a3175436112c0988","repo":"bvaughn/react-virtualized","slug":"fixed-height-cellmeasurercache-should-specify-a-d","errorCode":null,"errorMessage":"Fixed height CellMeasurerCache should specify a :defaultHeight greater than 0. Failing to do so will lead to unnecessary layout and poor performance.","messagePattern":"Fixed height CellMeasurerCache should specify a :defaultHeight greater than 0\\. Failing to do so will lead to unnecessary layout and poor performance\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"source/CellMeasurer/CellMeasurerCache.js","lineNumber":84,"sourceCode":"      this._minHeight,\n      typeof defaultHeight === 'number' ? defaultHeight : DEFAULT_HEIGHT,\n    );\n    this._defaultWidth = Math.max(\n      this._minWidth,\n      typeof defaultWidth === 'number' ? defaultWidth : DEFAULT_WIDTH,\n    );\n\n    if (process.env.NODE_ENV !== 'production') {\n      if (this._hasFixedHeight === false && this._hasFixedWidth === false) {\n        console.warn(\n          \"CellMeasurerCache should only measure a cell's width or height. \" +\n            'You have configured CellMeasurerCache to measure both. ' +\n            'This will result in poor performance.',\n        );\n      }\n\n      if (this._hasFixedHeight === false && this._defaultHeight === 0) {\n        console.warn(\n          'Fixed height CellMeasurerCache should specify a :defaultHeight greater than 0. ' +\n            'Failing to do so will lead to unnecessary layout and poor performance.',\n        );\n      }\n\n      if (this._hasFixedWidth === false && this._defaultWidth === 0) {\n        console.warn(\n          'Fixed width CellMeasurerCache should specify a :defaultWidth greater than 0. ' +\n            'Failing to do so will lead to unnecessary layout and poor performance.',\n        );\n      }\n    }\n  }\n\n  clear(rowIndex: number, columnIndex: number = 0) {\n    const key = this._keyMapper(rowIndex, columnIndex);\n\n    delete this._cellHeightCache[key];","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/bvaughn/react-virtualized/blob/c737715486f724586aee8870ebea1e9efb7b0bfe/source/CellMeasurer/CellMeasurerCache.js#L66-L102","documentation":"When height is NOT fixed (`fixedHeight` is false), CellMeasurerCache uses `defaultHeight` as the estimated height for unmeasured cells. A default of 0 makes the grid render zero-height rows initially, forcing constant relayout/remeasure as cells become visible. Dev-mode console warning only.","triggerScenarios":"`new CellMeasurerCache({fixedWidth: true})` (or neither fixed) without supplying `defaultHeight`, since the default is 0.","commonSituations":"Setting `fixedWidth: true` but forgetting `defaultHeight`; assuming the cache inherits a default height; scrollbars jumping because rows start at 0 height.","solutions":["Pass an explicit `defaultHeight` greater than 0 (a realistic average row height).","Set `fixedHeight: true` if heights are actually constant, providing `defaultHeight` as that constant.","Tune `defaultHeight` close to real content height to minimize reflow/jumping."],"exampleFix":"// before\nconst cache = new CellMeasurerCache({ fixedWidth: true });\n\n// after\nconst cache = new CellMeasurerCache({ fixedWidth: true, defaultHeight: 64 });","handlingStrategy":"validation","validationCode":"if (!opts.fixedHeight && !(opts.defaultHeight > 0)) throw new Error('Provide defaultHeight > 0 for CellMeasurerCache');","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pair fixedWidth:true with an explicit defaultHeight","Estimate defaultHeight from real content metrics","Wrap cache creation in a helper enforcing invariants"],"tags":["performance","cellmeasurer","configuration","layout"],"backgroundTag":"zero-default-dimension","analyzedSha":"c737715486f724586aee8870ebea1e9efb7b0bfe","analyzedAt":"2026-08-30T00:33:38.249Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}