Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-48756

Atto autosave does weird things on form submit

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      1. Set atto autosave frequency to 10 seconds
      2. Delete all records in mdl_editor_atto_autosave
      3. Open your javascript console and set the logs to be preserved across pages
      4. Head to the question bank and go to the form to add a new multiple choice question
      5. Confirm that there is only one request to autosave_ajax.php
      6. Type some text in a few of the editors in the page, and wait for the autosave confirmation (do not submit the form)
      7. Close your tab and go back to create a new multiple choice question
      8. Confirm that your drafts are being restored
      9. Click Cancel, and confirm that there is only one request to autosave_ajax.php.
      10. Go back to create a new multiple question and confirm that your drafts are not restored
      11. Fill in the form as if you were to create the question (make sure you won't get any validation error)
      12. Wait for Atto to save your drafts
      13. Submit the form
      14. Confirm that there is only one request to autosave_ajax.php
      15. Go back to create a new multiple question and confirm that your drafts are not restored
      16. Repeat the test on the page to add a new blog entry

      Multi-editor test

      1. Use the test_editor.php file attached, and...
      2. Confirm that the drafts are reset on submission/cancel but only for the submitted form

      Note that in test_editor.php, the cancel action also deletes the previously saved content.

      Show
      Set atto autosave frequency to 10 seconds Delete all records in mdl_editor_atto_autosave Open your javascript console and set the logs to be preserved across pages Head to the question bank and go to the form to add a new multiple choice question Confirm that there is only one request to autosave_ajax.php Type some text in a few of the editors in the page, and wait for the autosave confirmation (do not submit the form) Close your tab and go back to create a new multiple choice question Confirm that your drafts are being restored Click Cancel , and confirm that there is only one request to autosave_ajax.php . Go back to create a new multiple question and confirm that your drafts are not restored Fill in the form as if you were to create the question (make sure you won't get any validation error) Wait for Atto to save your drafts Submit the form Confirm that there is only one request to autosave_ajax.php Go back to create a new multiple question and confirm that your drafts are not restored Repeat the test on the page to add a new blog entry Multi-editor test Use the test_editor.php file attached, and... Confirm that the drafts are reset on submission/cancel but only for the submitted form Note that in test_editor.php, the cancel action also deletes the previously saved content.
    • Affected Branches:
      MOODLE_28_STABLE, MOODLE_30_STABLE, MOODLE_31_STABLE
    • Fixed Branches:
      MOODLE_30_STABLE, MOODLE_31_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-48756-master
    • Sprint:
      3.2 Sprint 1

      Description

      Steps to reproduce:

      1. Go to http://qa.moodle.net/question/question.php?returnurl=%2Fquestion%2Fedit.php%3Fcourseid%3D3&courseid=3&id=37 in Firefox
      2. Log in as Manager
      3. Press F12 to open the developer tools
      4. Click the setting gear, and turn on Common preferences -> Enable persistent logs.
      5. Switch to the Network tab in the developer tools.
      6. Click Save changes in the form.

      Expected result: the form saves immediately.

      Acutal result:

      1. There are many post requests to autosave-ajax.php (presumably one for each HTML editor).
      2. These post requests happen sequentially, not in parallel.
      3. Only after the last one completes does the form submit.

      (On my development server, each auto-save takes about 0.3s, so it adds up to an almost 4s delay in total, which is painful, which is why I started investigating.)

      I have not been able to clearly reproduce this in Chrome, though I got a partial reproduction by changing the contents of one editor just before submitting the form. That triggered 4 autosave-ajax.php requests before the main POST.

      I did notice that when you change the contents of one editor, when the auto-save kicks off, it does multiple Ajax requests in quick succession. That should also be looked at. Dan P also observerd various different weired behaviour on his Mac. (I am browers running under Win here.)

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                6 Vote for this issue
                Watchers:
                19 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  11/Jul/16