only bind queue event-handler for the first queued item, not of every queued item

jQuery.one() only makes sure each event-handler is called only once, but it does NOT stop installing multiple ones
This commit is contained in:
ralf 2024-03-18 16:14:44 +02:00
parent 9cffe8cbde
commit 05efd753fe

View File

@ -1112,8 +1112,11 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
}
// Bind so we can get the queued data when tab is re-activated
let tab = jQuery(this.getInstanceManager().DOMContainer.parentNode)
.one('show.et2_nextmatch', this._queue_refresh_callback.bind(this));
// only do it for this._queued_refreshes === [], to not install multiple event-handlers (jQuery.one() does NOT help here!)
if (Array.isArray(this._queued_refreshes) && !this._queued_refreshes.length)
{
jQuery(this.getInstanceManager().DOMContainer.parentNode).one('show.et2_nextmatch', this._queue_refresh_callback.bind(this));
}
// Edit means refresh everything, so no need to keep queueing