Moodle
  1. Moodle
  2. MDL-32881

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

    Details

    • Rank:
      39949

      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.

        Activity

        Show
        Dan Poltawski added a comment - http://dl.dropbox.com/u/5403781/badcaching.mov
        Hide
        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
        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
        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
        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
        Dan Poltawski added a comment -

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

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

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

        Show
        Andrew Nicols added a comment - Good point. Do you agree that it should also appear on the site frontpage?
        Hide
        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
        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
        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
        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
        Dan Poltawski added a comment -

        Looks good

        Show
        Dan Poltawski added a comment - Looks good
        Hide
        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
        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
        Sam Hemelryk added a comment -

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

        Show
        Sam Hemelryk added a comment - Thanks guys, changes look sensible, this has been integrated now
        Hide
        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 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
        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
        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
        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
        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
        Dan Poltawski added a comment -

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

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

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

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

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

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

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

        Show
        Ankit Agarwal added a comment - Working great now. Thanks for the quick fix. Passing!
        Hide
        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
        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: