[BUGFIX] Prevent recursive AJAX calls 39/56739/3
authorRalf Zimmermann <ralf.zimmermann@tritum.de>
Thu, 19 Apr 2018 15:25:07 +0000 (17:25 +0200)
committerAndreas Fernandez <a.fernandez@scripting-base.de>
Thu, 19 Apr 2018 15:48:04 +0000 (17:48 +0200)
The form editor calls the icon API within
jQuery's beforeSend() AJAX hook.
Since the Icon API also makes use of AJAX the result is a recursion.
This patch moves the icon requests out of the jQuery AJAX hook.

Resolves: #84797
Releases: master
Change-Id: Ie21806152802774f3f00b3d0320115aa5c0f26e7
Reviewed-on: https://review.typo3.org/56739
Reviewed-by: Björn Jacob <bjoern.jacob@tritum.de>
Tested-by: Björn Jacob <bjoern.jacob@tritum.de>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
typo3/sysext/form/Resources/Public/JavaScript/Backend/FormEditor/Mediator.js

index 8d8b6fe..2b59bc2 100644 (file)
@@ -207,6 +207,7 @@ define(['jquery',
       getPublisherSubscriber().subscribe('core/ajax/saveFormDefinition/success', function(topic, args) {
         getFormEditorApp().setUnsavedContent(false);
         getViewModel().showSaveSuccessMessage();
+        getViewModel().showSaveButtonSaveIcon();
 
         getFormEditorApp().setFormDefinition(args[0]['formDefinition']);
 
@@ -230,6 +231,7 @@ define(['jquery',
        * @subscribe core/ajax/saveFormDefinition/error
        */
       getPublisherSubscriber().subscribe('core/ajax/saveFormDefinition/error', function(topic, args) {
+        getViewModel().showSaveButtonSaveIcon();
         getViewModel().showSaveErrorMessage(args[0]);
       });
 
@@ -265,30 +267,6 @@ define(['jquery',
         }
       });
 
-      /**
-       * @private
-       *
-       * @param string
-       * @param array
-       * @return void
-       * @subscribe ajax/beforeSend
-       */
-      getPublisherSubscriber().subscribe('ajax/beforeSend', function(topic, args) {
-        getViewModel().showSaveButtonSpinnerIcon();
-      });
-
-      /**
-       * @private
-       *
-       * @param string
-       * @param array
-       * @return void
-       * @subscribe ajax/complete
-       */
-      getPublisherSubscriber().subscribe('ajax/complete', function(topic, args) {
-        getViewModel().showSaveButtonSaveIcon();
-      });
-
       /* *********************************************************
        * Header
        * ********************************************************/
@@ -305,6 +283,7 @@ define(['jquery',
         if (getFormEditorApp().validationResultsHasErrors(getFormEditorApp().validateFormElementRecursive(getRootFormElement(), true))) {
           getViewModel().showValidationErrorsModal();
         } else {
+          getViewModel().showSaveButtonSpinnerIcon();
           getFormEditorApp().saveFormDefinition();
         }
       });