wicketstuff / core

Wicketstuff-core projects are bundled user contributions for use with Apache Wicket (https://wicket.apache.org/). They are released in step with Wicket releases to make them easy to use.
340 stars 297 forks source link

wicketstuff-input-events - accumulating event listeners on AJAX components #711

Open reckart opened 3 years ago

reckart commented 3 years ago

When adding an InputBehavior to a component which is updated via AJAX, it can happen that the event listener registered by the InputBehavior is registered over and over again during AJAX updates. This is a resource leak and also can lead to input events being triggered way too often.

I believe a reasonable fix for this behavior would be to update the JS which registers the listener to remove any existing listener for the key binding for which the new listener is created. This is may be as simple as adding a shortcut.remove(keys) before the shortcut.add(keys,...)` call in the template.

martin-g commented 3 years ago

Pull Requests are welcome!