How long does it take for a UI script change to take effect?

cdgaefke
Kilo Expert

I have a non global UI script that is referenced in a UI Macro by a formatter (maybe it's the other way around) so that I can reference all the routines on my modules without the UI script being global.

 

I'm experiencing very odd timing problems.

 

I'll make a change in my UI script, reload the module, but the changes don't seem to be taking immediate effect.   And I'm not sure exactly how/when to get them to take effect.

 

I typically run with three browsers open:

 

Firefox is my main coding browser.

IE11 is used for my reference, IE, to see something else in SVN while coding in Firefox

Chrome I use for testing functionality

 

Up until now this setup was working fine for me.   I'd make a change in Firefox, save it, reload the module in Chrome and see the changes.

 

Now, however, I'm using the setup above, where a UI script is in a UI Macro that is in a formatter.   And I never know when my code is going to take affect.   I've tried reloading the module, logging out, closing browsers and relogging, pressing Ctrl-F5 to force a refresh, and I'm getting inconsistent results.   Sometimes my code is active, sometimes it isn't.   If I check the code, the changes are there in all the browsers, but it seems as if SVN is using an older version somewhere.   Right now I have a simple alert() in the beginning of my routine, and IE won't show it, but Firefox will.   And my most recent change isn't showing anywhere!

 

Last time this happened I thought I was running into browser compatibility issues, and I went home for the day slightly distressed that I have code that works in one browser and not another.   The next day, without making any changes, it suddenly worked in both browsers!   Now I understand it's the same timing issue I'm seeing now.

 

Any thoughts on this oddness?   It's making coding very difficult, as I never know if I have a typo somewhere or if my code just hasn't taken effect yet.

 

Thanks.

1 ACCEPTED SOLUTION

cdgaefke
Kilo Expert

I ended up opening a ticket on   HI about this.   The devs gave me this code to put in the UI Macro which works beautifully:



<?xml version="1.0" encoding="utf-8" ?>


<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">


          <g2:evaluate var="jvar_stamp">


                  var gr = new GlideRecord('sys_ui_script');


                  gr.orderByDesc('sys_updated_on');


                  gr.query();


                  gr.next();


                  gr.getValue('sys_updated_on');


          </g2:evaluate>


          <g:requires name="YOUR SCRIPT NAME HERE.jsdbx" params="cache=$[jvar_stamp]" />


</j:jelly>


View solution in original post

16 REPLIES 16

Thanks.   However the problem isn't just in IE.   (I have IE set to the proper browser cache settings anyhow.)   All three browsers are exhibiting this oddity.



I'm wondering if it's our company proxy.   Ctrl-F5 is supposed to force a refresh from a proxy, and didn't change anything.



The fact that the browsers are seeing different versions is particularly disconcerting.   As far as I can tell all three are on the same node (if I'm reading stats.do correctly).



Time to open a ticket on hi?


cdgaefke
Kilo Expert

It appears to be a browser cache issue.



Once I force delete all cache and cookies in IE and Chrome, and cache in Firefox (even though I have Firefox set to store ZERO cache), I consistently get the proper code.



Running in "incognito" mode in Chrome or private window in Firefox will make things easier, as I'll just have to close that window and reopen it.



Since all three browsers have this issue, is this an indication something in SVN isn't properly flagging the change to force the browser to get the new code, or is this a common problem across all three browsers?


cdgaefke
Kilo Expert

I ended up opening a ticket on   HI about this.   The devs gave me this code to put in the UI Macro which works beautifully:



<?xml version="1.0" encoding="utf-8" ?>


<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">


          <g2:evaluate var="jvar_stamp">


                  var gr = new GlideRecord('sys_ui_script');


                  gr.orderByDesc('sys_updated_on');


                  gr.query();


                  gr.next();


                  gr.getValue('sys_updated_on');


          </g2:evaluate>


          <g:requires name="YOUR SCRIPT NAME HERE.jsdbx" params="cache=$[jvar_stamp]" />


</j:jelly>


Thanks very much for sharing this info; This kind of stuff should be on wiki,



Best Regards,


One fix to the code, since g2 is null you need to change g2:evaluate to g:evaluate.


Here is what I ended up with since I only care about the sys_updated_on for my one UI Script.


<j:set var="jvar_UI_Script_name" value="MyUIScriptName"/>


<g:evaluate var="jvar_stamp">


var gr = new GlideRecord('sys_ui_script');


if(gr.get('name', '$[jvar_UI_Script_name]') ) gr.getValue('sys_updated_on');


</g:evaluate>


<g:requires name="$[jvar_UI_Script_name].jsdbx" params="cache=$[jvar_stamp]" />


If you do want to get the most recent date of all the UI Scripts then I suggest you add gr.setLimit(1) so you only get the one record you need.