1. #1
    Sencha User
    Join Date
    Apr 2011
    Posts
    65
    Vote Rating
    1
    c089 is on a distinguished road

      0  

    Default DisableCaching breaks javascript debuggers

    DisableCaching breaks javascript debuggers


    Good morning everyone

    Starting today, my javascript debuggers (chrome dev tools and firebug) stopped working. Every breakpoint I set was lost on a page reload. Looking at the files in Firebug, I noticed the "_dc" parameter which gets changed on every load to prevent caching, which sounds like a good idea while developing. However, this seems to be the reasons why the breakpoints are gone after a page reload, so I had to use Ext.loader.setConfig to deactivate the dc param. I'm really curious why I did not have this problem before and if there's a better way to do this?

    Chris

  2. #2
    Sencha - Ext JS Dev Team dongryphon's Avatar
    Join Date
    Jul 2009
    Posts
    1,346
    Vote Rating
    134
    dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all

      0  

    Default


    Hi Chris,

    This is expected if you have "?nocache" in your URL and it is a sad side-effect. A better approach is to turn off caching in Firebug (the Net tab has a dropdown menu w/Disable Browser Cache).

    Are you seeing this w/o "?nocache"?
    Don Griffin
    Ext JS Development Team Lead

    Check the docs. Learn how to (properly) report a framework issue and a Sencha Cmd issue

    "Use the source, Luke!"

  3. #3
    jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,360
    Vote Rating
    81
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    I need to test this out. From what I understand, firebug treats the JS files with arguments as different files, and that's why breakpoints disappear.

  4. #4
    Sencha User
    Join Date
    Apr 2011
    Posts
    65
    Vote Rating
    1
    c089 is on a distinguished road

      0  

    Default


    Quote Originally Posted by dongryphon View Post
    This is expected if you have "?nocache" in your URL and it is a sad side-effect. A better approach is to turn off caching in Firebug (the Net tab has a dropdown menu w/Disable Browser Cache).

    Are you seeing this w/o "?nocache"?
    Yup, I didn't even know about ?nocache.

  5. #5
    Sencha - Ext JS Dev Team dongryphon's Avatar
    Join Date
    Jul 2009
    Posts
    1,346
    Vote Rating
    134
    dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all

      0  

    Default


    You are correct: different URL = different File (URL includes query parameters). I don't see the "?dc" parameter on script tags unless I add "?nocache" to the page URL. But perhaps there are other reasons for the Loader to decide to add the "?dc" parameter... I'll have to look at the code.
    Don Griffin
    Ext JS Development Team Lead

    Check the docs. Learn how to (properly) report a framework issue and a Sencha Cmd issue

    "Use the source, Luke!"

  6. #6
    Ext JS Premium Member stevil's Avatar
    Join Date
    Nov 2007
    Location
    Denver, CO
    Posts
    1,045
    Vote Rating
    9
    stevil will become famous soon enough

      0  

    Default


    Quote Originally Posted by dongryphon View Post
    You are correct: different URL = different File (URL includes query parameters). I don't see the "?dc" parameter on script tags unless I add "?nocache" to the page URL. But perhaps there are other reasons for the Loader to decide to add the "?dc" parameter... I'll have to look at the code.
    +1

  7. #7
    Sencha User
    Join Date
    Apr 2008
    Posts
    19
    Vote Rating
    0
    --maty is on a distinguished road

      0  

    Default


    Any tips how to disable this _dc parameter from appending to my controller's url? I can't debug it during the load because of that...
    Also, my loader is like this, so either disableCaching is not working or there is a bug somewhere:
    Code:
        <script type="text/javascript" src="files/extjs/ext-all-debug.js"></script>
        <script type="text/javascript">
          Ext.Loader.setConfig({
            enabled:true,
            disableCaching:true
          });
        </script>
    Quote Originally Posted by dongryphon
    A better approach is to turn off caching in Firebug (the Net tab has a dropdown menu w/Disable Browser Cache).
    This trick doesn't work for me...

  8. #8
    Sencha - Ext JS Dev Team dongryphon's Avatar
    Join Date
    Jul 2009
    Posts
    1,346
    Vote Rating
    134
    dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all

      0  

    Default


    Have you tried disableCaching: false?

    _dc = disableCache

    So false should turn off this feature. Once off, the Firebug trick will be important to avoid stale responses from the Firefox cache.

    Chrome, sadly, has no such feature, which means you will either have to clear the entire cache often, or set this option to true and use "debugger" statements. Sad indeed
    Don Griffin
    Ext JS Development Team Lead

    Check the docs. Learn how to (properly) report a framework issue and a Sencha Cmd issue

    "Use the source, Luke!"

  9. #9
    Sencha User
    Join Date
    Nov 2011
    Posts
    72
    Vote Rating
    2
    sephyroth69 is on a distinguished road

      0  

    Default


    Hi guys,

    I'm having exactly the same issue on both Firefox and chrome, while testing my sencha touch 2 app. One of my controller (the one i'm editing) is getting "_dc" and a number append after it's name and every time I reload the page, the number changes. so no way to keep a breakpoint in the controller. However the fix proposed by dongryphon is working !

    Add this before your app code :


    Code:
    <script type="text/javascript"> 
            Ext.Loader.setConfig({
                    enabled:true, 
            disableCaching:true      }); 
       </script>
    Thanks a lot for the tip !

  10. #10
    Sencha Premium Member
    Join Date
    Mar 2013
    Posts
    39
    Vote Rating
    1
    cassinisolutions is on a distinguished road

      0  

    Default


    While debugging with NetBeans, I've had this problem also.

    FYI, Netbeans has just filled in an issue in order to be able to debug whatever this ExtJS config is
    (https://netbeans.org/bugzilla/show_bug.cgi?id=229383)

    And at last, when putting disableCaching to false, it becomes hard to debug as everything is kept in the cache of the browser

    You have several plugins for that to disable cache on browser side, but there's another option, which seems better (because no need to reload the browser)

    you put a livereload server that forces the browser to update the .js files whenever they get modified

    (AFAIK, I use grunt and grunt-livereload for that)

    Hope this helps

Similar Threads

  1. FYI : Browser Based Debuggers (firefox/IE/Safari/Opera)
    By dawesi in forum Community Discussion
    Replies: 0
    Last Post: 10 Jan 2008, 8:40 PM
  2. disableCaching in Ext.Ajax
    By Zakaroonikov in forum Community Discussion
    Replies: 2
    Last Post: 2 Aug 2007, 1:48 PM

Thread Participants: 6