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

Browser is incorrectly caching drag/drop position when back button is hit

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.3
    • Fix Version/s: 2.3
    • Component/s: Course, JavaScript
    • Labels:

      Description

      First of all this is only a browser problem, the info is stored in the database correctly and on forced reload it works fine. It also was present in old javascript.

      1/ Rearrange a module with JS drag drop
      2/ Click a link somewhere
      3/ Hit back

      Expected Result:

      • The moved module appears where you left it (or where it is stored in the DB)

      Actual Result:

      • The browser seems to be caching its starting potion.

      If we can we could do with telling the browser to not cache this.

        Gliffy Diagrams

          Activity

          Show
          poltawski Dan Poltawski added a comment - http://dl.dropbox.com/u/5403781/badcaching.mov
          Hide
          dobedobedoh Andrew Nicols added a comment -

          I think that adding no-store to the cache control should help here... looking into how this could be done...

          Show
          dobedobedoh Andrew Nicols added a comment - I think that adding no-store to the cache control should help here... looking into how this could be done...
          Hide
          dobedobedoh Andrew Nicols added a comment -

          Dan - can you try this patch? I've only applied it to course/view.php for the moment. It may be worth applying it to /index.php as that also has AJAX resource changing available.

          Andrew

          Show
          dobedobedoh Andrew Nicols added a comment - Dan - can you try this patch? I've only applied it to course/view.php for the moment. It may be worth applying it to /index.php as that also has AJAX resource changing available. Andrew
          Hide
          poltawski Dan Poltawski added a comment -

          Yep, that fixes it - cool! But I think that should only be there when editing on.

          Show
          poltawski Dan Poltawski added a comment - Yep, that fixes it - cool! But I think that should only be there when editing on.
          Hide
          dobedobedoh Andrew Nicols added a comment -

          Good point. Do you agree that it should also appear on the site frontpage?

          Show
          dobedobedoh Andrew Nicols added a comment - Good point. Do you agree that it should also appear on the site frontpage?
          Hide
          dobedobedoh Andrew Nicols added a comment -

          As an alternative, this could live in course/lib.php::include_course_ajax() – this will ensure that it's only included if ajax is actually enabled and included which is the only time that non-caching might cause these kinds of issues.

          Does this seem appropriate or an abuse of that function?

          Show
          dobedobedoh Andrew Nicols added a comment - As an alternative, this could live in course/lib.php::include_course_ajax() – this will ensure that it's only included if ajax is actually enabled and included which is the only time that non-caching might cause these kinds of issues. Does this seem appropriate or an abuse of that function?
          Hide
          dobedobedoh Andrew Nicols added a comment -

          Have taken your thoughts on board and moved the set_cacheable call to the include_course_ajax call instead.

          Show
          dobedobedoh Andrew Nicols added a comment - Have taken your thoughts on board and moved the set_cacheable call to the include_course_ajax call instead.
          Hide
          poltawski Dan Poltawski added a comment -

          Looks good

          Show
          poltawski Dan Poltawski added a comment - Looks good
          Hide
          stronk7 Eloy Lafuente (stronk7) added a comment -

          The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week.

          TIA and ciao

          Show
          stronk7 Eloy Lafuente (stronk7) added a comment - The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week. TIA and ciao
          Hide
          samhemelryk Sam Hemelryk added a comment -

          Thanks guys, changes look sensible, this has been integrated now

          Show
          samhemelryk Sam Hemelryk added a comment - Thanks guys, changes look sensible, this has been integrated now
          Hide
          ankit_frenz Ankit Agarwal added a comment -

          Sorry guys,
          But this is not working as it was expected to work.

          If I move a module and click a link and hit back, the module doesn't appear at the place where I left it. Al tough everything is fine once I refresh the page.

          Tested on ff and chromium.

          Failing this.
          Thanks

          Show
          ankit_frenz Ankit Agarwal added a comment - Sorry guys, But this is not working as it was expected to work. If I move a module and click a link and hit back, the module doesn't appear at the place where I left it. Al tough everything is fine once I refresh the page. Tested on ff and chromium. Failing this. Thanks
          Hide
          poltawski Dan Poltawski added a comment -

          Andrew: my theory is that you are now setting the option too late (when page headers have been sent)

          Show
          poltawski Dan Poltawski added a comment - Andrew: my theory is that you are now setting the option too late (when page headers have been sent)
          Hide
          dobedobedoh Andrew Nicols added a comment -

          Looking at this, I think you're right Dan.

          I'll move them back to the course/view.php and index.php

          Show
          dobedobedoh Andrew Nicols added a comment - Looking at this, I think you're right Dan. I'll move them back to the course/view.php and index.php
          Hide
          poltawski Dan Poltawski added a comment -

          (btw maybe the method should throw a debugging notice if called too late)

          Show
          poltawski Dan Poltawski added a comment - (btw maybe the method should throw a debugging notice if called too late)
          Hide
          dobedobedoh Andrew Nicols added a comment -

          I've moved them to just after the other $PAGE calls. Well spotted

          Show
          dobedobedoh Andrew Nicols added a comment - I've moved them to just after the other $PAGE calls. Well spotted
          Hide
          samhemelryk Sam Hemelryk added a comment -

          Thanks for fixing that up Andrew, revision has been integrated now.

          Show
          samhemelryk Sam Hemelryk added a comment - Thanks for fixing that up Andrew, revision has been integrated now.
          Hide
          ankit_frenz Ankit Agarwal added a comment -

          Working great now.
          Thanks for the quick fix.
          Passing!

          Show
          ankit_frenz Ankit Agarwal added a comment - Working great now. Thanks for the quick fix. Passing!
          Hide
          stronk7 Eloy Lafuente (stronk7) added a comment -

          U P S T R E A M I Z E D !

          Many thanks for the hard work, closing this as fixed.

          Ciao

          Show
          stronk7 Eloy Lafuente (stronk7) added a comment - U P S T R E A M I Z E D ! Many thanks for the hard work, closing this as fixed. Ciao

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                25/Jun/12