From 7ffd1d45044cc028838ceec203c96ea382ec0b8a Mon Sep 17 00:00:00 2001 From: Tom Najdek Date: Thu, 15 May 2025 13:48:25 +0200 Subject: [PATCH] Unhide "title" column on "Restore Column Order" (#5299) This actually checks for a "primary" column, so if an extension hides the "title" column but provides its own "primary" column, the "title" column remains hidden. --- chrome/content/zotero/components/virtualized-table.jsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/chrome/content/zotero/components/virtualized-table.jsx b/chrome/content/zotero/components/virtualized-table.jsx index b94b101c41..6a7de25468 100644 --- a/chrome/content/zotero/components/virtualized-table.jsx +++ b/chrome/content/zotero/components/virtualized-table.jsx @@ -1692,6 +1692,16 @@ var Columns = class { } } this._columns.sort((a, b) => a.ordinal - b.ordinal); + + // Recover from scenarios where a plugin disables the "title" column and + // does not provide its own primary column, or is later removed and the + // "title" column is never restored. + let hasPrimaryColumn = this._columns.some(c => c.primary && !c.hidden); + if (!hasPrimaryColumn) { + Zotero.debug(`VirtualizedTable: Missing primary column, re-enabling the "title" column.`); + this._columns.find(c => c.dataKey === 'title').hidden = false; + } + this._adjustColumnWidths(); this.onResize(Object.fromEntries(this._columns.map(c => [c.dataKey, c.width]))); this._storePrefs(prefs);