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

Lazily load moodle-core-popuphelp dependencies

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Won't Fix
    • Affects Version/s: 2.6
    • Fix Version/s: None
    • Component/s: JavaScript
    • Labels:
    • Testing Instructions:
      Hide

      With the JS console open and watching for errors. You'll also want the Network activity tab open and filtered to show only JavaScript/Scripts

      • open the front page
        • confirm no errors
      • open the login page
        • confirm no errors
        • confirm that not too many dependencies were loaded - certainly not moodle-core-tooltip
      • click on the help icon
        • confirm that the popup was correctly shown
        • confirm that the activity tab showed a couple of new requests for new JS
      • edit lib/outputrenderers.php and search for popuphelp
      • replace:

        $this->page->requires->yui_module('moodle-core-popuphelp', 'M.core.init_popuphelp');
        

        with:

        $this->page->requires->yui_module('moodle-core-popuphelp', 'M.core.init_popuphelp', array(array('preventLazyLoading' => true)));
        

      • refresh the login page
        • confirm that moodle-core-tooltip was included this time
      • click on the help icon for logging in
        • confirm that there are no page loads for new scripts
      Show
      With the JS console open and watching for errors. You'll also want the Network activity tab open and filtered to show only JavaScript/Scripts open the front page confirm no errors open the login page confirm no errors confirm that not too many dependencies were loaded - certainly not moodle-core-tooltip click on the help icon confirm that the popup was correctly shown confirm that the activity tab showed a couple of new requests for new JS edit lib/outputrenderers.php and search for popuphelp replace: $this->page->requires->yui_module('moodle-core-popuphelp', 'M.core.init_popuphelp'); with: $this->page->requires->yui_module('moodle-core-popuphelp', 'M.core.init_popuphelp', array(array('preventLazyLoading' => true))); refresh the login page confirm that moodle-core-tooltip was included this time click on the help icon for logging in confirm that there are no page loads for new scripts
    • Affected Branches:
      MOODLE_26_STABLE
    • Pull Master Branch:

      Description

      We load popuphelp on every page, but since it's a dialogue, it has quite a few dependencies.

      We should attempt to lazily load them rather than loading the entire stack for each page when most of the time, help won't be used.

      I've provided a mechanism to prevent this action as Tim Hunt was looking at ways of seeding the popuphelp with strings to explain what to do in the event that you lose your internet connection during a quiz and we need to therefore have all dependencies pre-loaded already.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                dobedobedoh Andrew Nicols
                Reporter:
                dobedobedoh Andrew Nicols
                Peer reviewer:
                Frédéric Massart
                Participants:
                Component watchers:
                Jake Dallimore, Jun Pataleta, Ryan Wyllie
              • Votes:
                1 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: