{"record":{"id":"9ca886461d9e361c","repo":"bvaughn/react-virtualized","slug":"fixed-width-cellmeasurercache-should-specify-a-de","errorCode":null,"errorMessage":"Fixed width CellMeasurerCache should specify a :defaultWidth greater than 0. Failing to do so will lead to unnecessary layout and poor performance.","messagePattern":"Fixed width CellMeasurerCache should specify a :defaultWidth 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":91,"sourceCode":"\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];\n    delete this._cellWidthCache[key];\n\n    this._updateCachedColumnAndRowSizes(rowIndex, columnIndex);\n  }\n\n  clearAll() {\n    this._cellHeightCache = {};","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/bvaughn/react-virtualized/blob/c737715486f724586aee8870ebea1e9efb7b0bfe/source/CellMeasurer/CellMeasurerCache.js#L73-L109","documentation":"Symmetric to error 2: when width is NOT fixed, `defaultWidth` (default 0) is used as the width estimate for unmeasured cells, causing unnecessary layout work and poor performance. Dev-mode console warning only.","triggerScenarios":"`new CellMeasurerCache({fixedHeight: true})` (or neither fixed) without a `defaultWidth` greater than 0.","commonSituations":"Fixed-height rows with variable-width columns in Grid, but no `defaultWidth` supplied; assuming width is inferred from container.","solutions":["Pass an explicit `defaultWidth` greater than 0.","Set `fixedWidth: true` if widths are constant, supplying that width.","Match `defaultWidth` to the typical rendered width to reduce relayout."],"exampleFix":"// before\nconst cache = new CellMeasurerCache({ fixedHeight: true });\n\n// after\nconst cache = new CellMeasurerCache({ fixedHeight: true, defaultWidth: 200 });","handlingStrategy":"validation","validationCode":"if (!opts.fixedWidth && !(opts.defaultWidth > 0)) throw new Error('Provide defaultWidth > 0 for CellMeasurerCache');","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pair fixedHeight:true with an explicit defaultWidth","Estimate defaultWidth from typical content","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"}