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

The blocks system passes data to JavaScript in a bad way which can trigger the js_call_amd debug warning

XMLWordPrintable

    • MOODLE_310_STABLE, MOODLE_32_STABLE, MOODLE_38_STABLE, MOODLE_39_STABLE, MOODLE_400_STABLE
    • MOODLE_311_STABLE
    • MDL-57614-master-4
    • Hide

      Prerequisites

      • Instance with many blocks installed (at least ~ 100)

      Test 1

      1. Login as Admin.
      2. Go to Site administration > Development > Debugging
        1. Set Debug messages = "DEVELOPER ..."
        2. Save changes.
      3. Go to Site home.
      4. Turn editing on.
        • confirm you DO NOT see a warning message "Too much data passed as arguments to js_call_amd("core/addblockmodal", "init") ..."
      5. Click on the "Add a block" link from the navigation menu.
        1. confirm the 'Add a block' modal is shown
        2. confirm a loading spinner is displayed while the blocks list is being obtained.
        3. once the blocks list is obtained, confirm the proper available blocks are being displayed in the modal.

      Test 2

      Initially, you will need to force the webservice that fetches the blocks to throw an error.
      You can do that by manually adding this code into execute() method in the fetch_addable_blocks class (/blocks/classes/external/fetch_addable_blocks.php) before the return statement.

      throw new Exception('Error');
      

      1. Login as Admin.
      2. Go to Site home.
      3. Turn editing on.
      4. Click on the "Add a block" link from the navigation menu.
        1. confirm that a notification (error) is shown.
        2. confirm that you CANNOT see the 'Add a block' modal.

      NOTE : Once you attempt to close the error notification, the modal backdrop might not be cleared which will prevent you to click or perform any other action on the page. Thus, you will need to refresh the page. This is a preexisting issue in the modal code and not directly related to the work done on this issue.  

      Show
      Prerequisites Instance with many blocks installed (at least ~ 100) Test 1 Login as Admin. Go to Site administration > Development > Debugging Set Debug messages = "DEVELOPER ..." Save changes. Go to Site home. Turn editing on. confirm you DO NOT see a warning message "Too much data passed as arguments to js_call_amd("core/addblockmodal", "init") ..." Click on the "Add a block" link from the navigation menu. confirm the 'Add a block' modal is shown confirm a loading spinner is displayed while the blocks list is being obtained. once the blocks list is obtained, confirm the proper available blocks are being displayed in the modal. Test 2 Initially, you will need to force the webservice that fetches the blocks to throw an error. You can do that by manually adding this code into execute() method in the fetch_addable_blocks class (/blocks/classes/external/fetch_addable_blocks.php) before the return statement. throw new Exception( 'Error' ); Login as Admin. Go to Site home. Turn editing on. Click on the "Add a block" link from the navigation menu. confirm that a notification (error) is shown. confirm that you CANNOT see the 'Add a block' modal. NOTE : Once you attempt to close the error notification, the modal backdrop might not be cleared which will prevent you to click or perform any other action on the page. Thus, you will need to refresh the page. This is a preexisting issue in the modal code and not directly related to the work done on this issue.  
    • 3
    • 4.0 holding pattern 7, 4.0 holding pattern 8, 4.0 holding pattern 9

      In Editing mode, when an instance has lots of blocks installed, the js_call_amd debug warning is triggered because of the way the blocks data is being passed to 'core/addblockmodal' amd module. Ideally, the list of available blocks should be obtained in different manner.

            Geshoski Mihail Geshoski
            vf Valery Fremaux
            Peter Dias Peter Dias
            Andrew Lyons Andrew Lyons
            Janelle Barcega Janelle Barcega
            Votes:
            4 Vote for this issue
            Watchers:
            13 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 day, 5 hours, 41 minutes
                1d 5h 41m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.