CouchDB
  1. CouchDB
  2. COUCHDB-1090

jquery.couch.js enforces cache option

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Trivial Trivial
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Infrastructure
    • Labels:
      None

      Description

      jquery.couch.js explicitly sets a cache, preventing the programmer from being able to set it

      1. cache.patch
        0.6 kB
        Dale Harvey

        Activity

        Hide
        Jan Lehnardt added a comment -

        I remember this has been in for a long time, I'm hesitant to just remove the option, how about an override:

        diff --git a/share/www/script/jquery.couch.js b/share/www/script/jquery.couch.js
        index 9e31cef..3fbd0d1 100644
        — a/share/www/script/jquery.couch.js
        +++ b/share/www/script/jquery.couch.js
        @@ -1025,7 +1025,7 @@
        ajaxOptions = $.extend(

        {contentType: "application/json"}

        , ajaxOptions);
        errorMessage = errorMessage || "Unknown error";
        $.ajax($.extend($.extend({

        • type: "GET", dataType: "json", cache : !$.browser.msie,
          + type: "GET", dataType: "json", cache : options.cache || !$.browser.msie,
          beforeSend: function(xhr){
          if(ajaxOptions && ajaxOptions.headers){
          for (var header in ajaxOptions.headers){
        Show
        Jan Lehnardt added a comment - I remember this has been in for a long time, I'm hesitant to just remove the option, how about an override: diff --git a/share/www/script/jquery.couch.js b/share/www/script/jquery.couch.js index 9e31cef..3fbd0d1 100644 — a/share/www/script/jquery.couch.js +++ b/share/www/script/jquery.couch.js @@ -1025,7 +1025,7 @@ ajaxOptions = $.extend( {contentType: "application/json"} , ajaxOptions); errorMessage = errorMessage || "Unknown error"; $.ajax($.extend($.extend({ type: "GET", dataType: "json", cache : !$.browser.msie, + type: "GET", dataType: "json", cache : options.cache || !$.browser.msie, beforeSend: function(xhr){ if(ajaxOptions && ajaxOptions.headers){ for (var header in ajaxOptions.headers){
        Hide
        Dale Harvey added a comment -

        the reason I took it out completely is that it already is an option

        $.ajaxSetup(

        { cache: false }

        );

        and it can be passed through the options as long as it isnt set explicity, I would say its up to jquery to specify sensible defaults and if futon wants no cache in ie it can add it itself, I am happy either way though as long as the developer can specify

        Show
        Dale Harvey added a comment - the reason I took it out completely is that it already is an option $.ajaxSetup( { cache: false } ); and it can be passed through the options as long as it isnt set explicity, I would say its up to jquery to specify sensible defaults and if futon wants no cache in ie it can add it itself, I am happy either way though as long as the developer can specify
        Hide
        Jan Lehnardt added a comment -

        Good point Dale,

        This is where jquery.couch.js lives a dangerous double life as Futon's CouchDB lib and a general purpose jQuery CouchDB API. I agree that the default should be moved to Futon code as I think jquery.couch.js should not be just Futon's library.

        Show
        Jan Lehnardt added a comment - Good point Dale, This is where jquery.couch.js lives a dangerous double life as Futon's CouchDB lib and a general purpose jQuery CouchDB API. I agree that the default should be moved to Futon code as I think jquery.couch.js should not be just Futon's library.
        Hide
        Dale Harvey added a comment -

        I dont think its sensible to have jquery.couch drive futon and be a dep for other apps, standalone jquery.couch makes more sense.

        Show
        Dale Harvey added a comment - I dont think its sensible to have jquery.couch drive futon and be a dep for other apps, standalone jquery.couch makes more sense.
        Hide
        Jan Lehnardt added a comment -

        I do like the idea of decoupling jquery.couch.js from CouchDB and Futon and make Futon just another application that depends on jquery.couch.js.

        Show
        Jan Lehnardt added a comment - I do like the idea of decoupling jquery.couch.js from CouchDB and Futon and make Futon just another application that depends on jquery.couch.js.
        Hide
        Randall Leeds added a comment -

        Sorry to chime in late, but I don't think you should shy away from removing that line.

        Show
        Randall Leeds added a comment - Sorry to chime in late, but I don't think you should shy away from removing that line.

          People

          • Assignee:
            Unassigned
            Reporter:
            Dale Harvey
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development