windingwind / zotero-actions-tags

Customize your Zotero workflow.
GNU Affero General Public License v3.0
1.94k stars 48 forks source link

[Bug] Add/toggle/remove tag fails for a Close Tab event if tabs already opened at program start #399

Closed sivart213 closed 3 weeks ago

sivart213 commented 2 months ago

Is there an existing issue for this?

Are you using the latest Zotero and the latest plugin?

Environment

Describe the bug

If any item is automatically opened on program start (i.e. the file/tab was open when Zotero was last closed), any add/toggle/remove tag operation initiated by a "Close Tab" event fails to run when the tab is closed. How it's closed and if it is viewed before closing or not has no impact.

For context, I use an "/open" tag to use the modified date to keep track of recent readings and closures, adding the tag on open and removing on close. I verified that the action works under other circumstances. Any file opened after program start results in expected tag operations. If a file is "re-opened" by double clicking the item in the library (without closing the tab), the "Close Tab" action will now work as expected.

I have also noticed that any "Close Tab" action will be called randomly even if the tab has not been closed. I noticed this after setting a toggle tag on the "Close Tab" action wherein it seems to toggle after viewing ~5 different files. This happens on already open tabs and simply selecting between them. I suspect that the tab may be getting put to sleep or dumped from the cache. Interestingly, this behavior does seem to apply for tabs already open at program start.

I have added the debug for the closing of a tab already open when the program is started.

Debug Output

1727898772499 addons.xpi-utils WARN disabling legacy extension zotfile@columbia.edu

1727898772499 addons.xpi-utils WARN disabling legacy extension zotero-wikicite@wikidata.org

1727898772500 addons.xpi-utils WARN disabling legacy extension zutilo@www.wesailatdawn.com

appName => Zotero, version => 7.0.5 (x64), os => Windows 11 22631, locale => en-GB, extensions => Actions and Tags for Zotero (2.0.2, extension), ZotFile (5.1.2, extension, disabled), Cita (0.5.5, extension, disabled), Zutilo Utility for Zotero (3.10.0, extension, disabled), DOI Manager (1.5.0, extension, disabled), ZotMoov (1.1.14, extension, disabled), Better BibTex for Zotero (6.7.240, extension, disabled) (4)(+0010650): SELECT COUNT(*) FROM settings WHERE setting='mImport' AND key='cleanup'

(3)(+0000825): Scheduling next feed update

(4)(+0000000): SELECT ( CASE WHEN lastCheck IS NULL THEN 0 ELSE strftime('%s', lastCheck) + refreshInterval * 60 - strftime('%s', 'now') END ) AS nextCheck FROM feeds WHERE refreshInterval IS NOT NULL ORDER BY nextCheck ASC LIMIT 1

(3)(+0000001): No feeds with auto-update

(4)(+0000000): SELECT libraryID AS id FROM feeds WHERE refreshInterval IS NOT NULL AND ( lastCheck IS NULL OR (julianday(lastCheck, 'utc') + (refreshInterval/1440.0) - julianday('now', 'utc')) <= 0 )

(3)(+0000001): Running update for feeds:

(3)(+0000000): All feed updates done

(3)(+0000000): Scheduling next feed update

(4)(+0000001): SELECT ( CASE WHEN lastCheck IS NULL THEN 0 ELSE strftime('%s', lastCheck) + refreshInterval * 60 - strftime('%s', 'now') END ) AS nextCheck FROM feeds WHERE refreshInterval IS NOT NULL ORDER BY nextCheck ASC LIMIT 1

(3)(+0000002): No feeds with auto-update

(3)(+0003149): Notifier.trigger('select', 'tab', [zotero-pane], {"zotero-pane":{"type":"library"}}) called [observers: 7]

(3)(+0000001): Notifier.trigger('close', 'tab', [tab-07dKAj9F], true) called [observers: 7]

(3)(+0000000): BlockingObserver: Removed observer

(4)(+0000014): Unregistering notifier observer in notifier with id 'ItemDetails_MC'

(4)(+0000000): Unregistering notifier observer in notifier with id 'paneHeader_SW'

(4)(+0000000): Unregistering notifier observer in notifier with id 'itemBox_pU'

(4)(+0000002): Unregistering notifier observer in notifier with id 'abstractBox_VR'

(4)(+0000000): Unregistering notifier observer in notifier with id 'attachmentsBox_qe'

(4)(+0000001): Unregistering notifier observer in notifier with id 'notesBox_0T'

(4)(+0000000): Unregistering notifier observer in notifier with id 'attachmentbox_Ud'

(4)(+0000000): Unregistering notifier observer in notifier with id 'noteEditor_wh'

(4)(+0000000): Unregistering notifier observer in notifier with id 'tagsBox_rA'

(4)(+0000001): Unregistering notifier observer in notifier with id 'relatedbox_Wy'

(4)(+0000000): Unregistering notifier observer in notifier with id 'attachmentAnnotationsBox_WC'

(4)(+0000000): Unregistering notifier observer in notifier with id 'librariesCollectionsBox_5U'

(4)(+0000000): Unregistering notifier observer in notifier with id 'tagsBox_UA'

(4)(+0000000): Unregistering notifier observer in notifier with id 'relatedbox_nY'

(3)(+0000002): [Actions and Tags for Zotero] notify select tab ["zotero-pane"] {"zotero-pane":{"type":"library"}}

(3)(+0000000): [Actions and Tags for Zotero] notify close tab ["tab-07dKAj9F"] true

(3)(+0000001): Observer no longer exists

(3)(+0000000): Observer no longer exists

(3)(+0000290): itemTree.render(). Displaying Item Tree

(3)(+0015676): Starting full-text content processor

(4)(+0000003): Registering notifier observer 'fulltext_Dw' for [sync]

Anything else?

No response

github-actions[bot] commented 1 month ago

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] commented 3 weeks ago

This issue was closed because it has been inactive for 7 days since being marked as stale.