Looks like we can't reproduce the issue or there's a problem in the test case provided.
  1. #1
    Sencha User
    Join Date
    Oct 2011
    Location
    Pune, India
    Posts
    22
    Vote Rating
    0
    krislogy is on a distinguished road

      0  

    Default Production Build Using SDK - Local-Storage File Cache - Does NOT get updated

    Production Build Using SDK - Local-Storage File Cache - Does NOT get updated


    Problem as stated in the topic above; when I do a new production build
    Code:
    command: "sencha app build production"
    - and run the app, the new/changed contents in js/css files, whatever they may be, do not get updated on to the local-storage automatically.
    - They run the same old previous version scripts/stylesheets (even if I hit "refresh" button).
    - Only when I clear cache "manually" from browser preferences do the new contents load in. (meaning all this works on "first-time" loads, but subsequent updates using version-checking don't.)

    So, here's my setup scene:
    1. I use "delta" update mode for my "app.js", and use "full" update mode for "myapp.css". Both have the same problem as mentioned above. (So I'm sure that this is not an update-type issue)
      ..
    2. I dug deeper into "production.js" and found this code:
      Code:
      currentAssets.forEach(function (asset) {
          var content = retrieveAsset(asset);
          if (content === null) {
              requestAsset(asset, function (content) {
                  storeAsset(asset, content);
                  onAssetReady(asset, content)
              }, function () {
                  onAssetReady(asset, "")
              })
          } else {
              onAssetReady(asset, content)
          }
      })
      ..
    3. This means, it will always load the locally cached content "first", even if there is an updated content available. The "version checking" happens only later on.
      ..
    4. Anyway, I could've made peace with it if it had atleast "stored" the updated contents later on, but it doesn't do that either.
      ..
    5. Here's further code, when and why it "doesn't" update new content:
      Code:
      // there is this variable: "appCache.status", where the definition of appCache is:
      appCache = window.applicationCache;
      
      // and further down, there is this function:
      function onAssetUpdated(asset, content) {
          asset.content = content;
          if (--updatingCount == 0) {
              if (appCache.status == appCache.IDLE) {
                  doUpdate()
              } else {
                  onAppCacheIdle = doUpdate
              }
          }
      }
      // but the "doUpdate()" function NEVER gets called.
      The problem is that the value of appCache.status is ALWAYS 0. Is that fine? I even tried manually setting it to some other value while debugging, but I suppose its a read-only native property. It doesn't work..
      ..
    6. Or is there something I'm missing? Like some cache.manifest file that "enables" this status.. or something else?
      ..
    7. Or is it just because I've been doing all this locally (http://localhost) and that I should try it out on a prod env? (naaah.. this cant be the problem)
    8. Or.....?

    FYI:
    1. I did make some edits in the "production.js" file to suit to my needs. But I assure you nothing of the sort that would break the existing flow.
    2. Using Safari 5.1.1 on Windows for testing.

    Thanks for the help!!

    --
    Kris

  2. #2
    Sencha User
    Join Date
    Oct 2011
    Location
    Pune, India
    Posts
    22
    Vote Rating
    0
    krislogy is on a distinguished road

      0  

    Default


    And that is the lesson you learn for not putting cache.manifest file in your page.

    The applicationCache status will always be 0 if you don't have a manifest/appCache file in your page.

    Please close this thread.

    (Damn! what a waste, typing all this, when the answer was just behind the window... Anyway, hope it helps someone else better)

  3. #3
    Ext JS Premium Member
    Join Date
    Feb 2010
    Posts
    28
    Vote Rating
    0
    jlindbergh is on a distinguished road

      0  

    Default


    Very helpful info, thanks!