fix tab duplication breakage (#4286)

Fix to breakage after 3f45def that would not open a duplicate
tab but instead create another reader instance in the same tab.
Instead of finding a tab for a specific item, use tabID that
is passed when reader should be loaded in an unloaded tab. That
allows us to know if the tab is being duplicated or not.

Fixes: #4272
This commit is contained in:
abaevbog 2024-06-26 22:19:25 -07:00 committed by GitHub
parent 4eb4741795
commit f6b47987e9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1016,7 +1016,7 @@ class ReaderTab extends ReaderInstance {
this._onToggleSidebarCallback = options.onToggleSidebar;
this._onChangeSidebarWidthCallback = options.onChangeSidebarWidth;
this._window = Services.wm.getMostRecentWindow('navigator:browser');
let existingTabID = this._window.Zotero_Tabs.getTabIDByItemID(this._item.id);
let existingTabID = options.tabID;
// If an unloaded tab for this item already exists, load the reader in it.
// Otherwise, create a new tab
if (existingTabID) {