-
Notifications
You must be signed in to change notification settings - Fork 28
Description
Hello,
We are experiencing an issue with all our sites since version 9 of Concrete. When modifying a page attribute, the save action sometimes occurs twice.
Upon investigation, we noticed that the click event on the "save" button was bound twice in the "Attributes" composer.
Looking more closely, we observed that the "loadPanelDetailActions" function that binds the event is executed four times on the page. Twice when clicking on "Page Design, Location, Attributes and Settings" and twice when clicking on "Attributes".
On a fresh Concrete installation, the double bind issue is hard to reproduce, but not impossible. After repeatedly clicking on these two buttons, we eventually encounter it.
However, on a well-populated Concrete site, we face this issue almost every time.
By adding a .off("click") before the bind, we managed to fix the problem. We believe it would be best to avoid these four calls, but we do not know the code well enough to understand why these four calls occur. Do you have any other solutions?
The fix we implemented is as follows:
bedrock/assets/cms/js/panels.js
328 this.loadPanelDetailActions = function ($content) {
...
336 $('button[data-panel-detail-action=submit]').off('click').on('click', function () {
337 $('[data-panel-detail-form]').submit()
338 })
Can you integrate this fix or an equivalent one?