From 9a5657bf79b68ca617cf857d2624dda276d45234 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adomas=20Ven=C4=8Dkauskas?= Date: Mon, 4 Apr 2022 16:05:02 +0300 Subject: [PATCH] Item Tree: Fix fixed-width columns sometimes changing width --- .../content/zotero/components/virtualized-table.jsx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/chrome/content/zotero/components/virtualized-table.jsx b/chrome/content/zotero/components/virtualized-table.jsx index f4a5374e23..ba62968a57 100644 --- a/chrome/content/zotero/components/virtualized-table.jsx +++ b/chrome/content/zotero/components/virtualized-table.jsx @@ -1331,6 +1331,11 @@ var Columns = class { let columns = this._columns = []; for (let column of virtualizedTable.props.columns) { + // Fixed width columns can sometimes somehow obtain a width property + // this fixes it for users that may have run into the bug + if (column.fixedWidth) { + delete columnsSettings[column.dataKey].width;; + } column = Object.assign({}, column, columnsSettings[column.dataKey]); column.className = cx(column.className, column.dataKey, column.dataKey + this._cssSuffix, { 'fixed-width': column.fixedWidth }); @@ -1448,9 +1453,9 @@ var Columns = class { } const column = this._columns.find(column => column.dataKey == dataKey); const styleIndex = this._columnStyleMap[dataKey]; - if (storePrefs && (!column.fixedWidth || (column.zoteroPersist && !column.zoteroPersist.has('width')))) { - prefs[dataKey] = prefs[dataKey] || {}; - prefs[dataKey].width = width; + if (storePrefs && !column.fixedWidth) { + column.width = width; + prefs[dataKey] = this._getColumnPrefsToPersist(column); } if (column.fixedWidth && column.width) { this._stylesheet.sheet.cssRules[styleIndex].style.setProperty('flex', `0 0`, `important`);