You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by abangkis <ab...@gmail.com> on 2015/02/07 05:24:15 UTC

Weird behaviour, require js doesn't refresh changed js file immediately

Hi guys, another question about require js. So i experiment with creating a
new source folder in eclipse by the name of requiresrc. Under that folder
will reside the META-INF/modules/my_javascript.js file. This way eclipse
will deploy the META-INF/modules folder to the classes module
automatically. It worked.

The problem is when i change my_javascript.js file content. The content
doesn't get refreshed automatically. Hitting F5 and Shift-F5 doesn't change
it too. But after a while (5-10 second) then the content will be changed
automatically.

Looking around i found this related thread
http://www.wenda.io/questions/4211439/force-refresh-doesnt-work-for-head-js.html
basically it says that F5 wouldn't work because of the dynamic script
loading. So, does anyone have a trick with this kind of thing? Because I'm
used of putting my js folder under WebApp folder and hitting refresh,
 tapestry would pick up the new content. Restarting the app every time i
change the js file would be a big pain.

Thanks :)

-- 
http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
twitter : @mreunionlabs @abangkis
page : https://plus.google.com/104168782385184990771

Re: Weird behaviour, require js doesn't refresh changed js file immediately

Posted by abangkis <ab...@gmail.com>.
Thanks Howard. Yeah, i guess just gonna live with the work around for now
:)

On Tue, Feb 10, 2015 at 10:21 PM, Howard Lewis Ship <hl...@gmail.com>
wrote:

> For modules, which can't be fingerprinted with a checksum in the URL,
> Tapestry applies a short expiration time in development, and a much longer
> one in production. I suspect you are hitting that.  A hard refresh,
> clearing the local cache, should force the browser to request the updated
> resource.
>
> Sometimes the browser just refuses to get the resource; you can see this
> when it looks one way in the browser, and differently and correctly via
> curl or httpie.
>
> On Sun, Feb 8, 2015 at 10:49 PM, abangkis <ab...@gmail.com> wrote:
>
> > Ok, my workaround is to add some kind of index number to log to
> javascript
> > console such as : console.log("29. Google map is ready"); I keep
> refreshing
> > until the number is changed. For now it's good enough but hopefully
> there's
> > a better solution in the future.
> >
> > On Sat, Feb 7, 2015 at 11:24 AM, abangkis <ab...@gmail.com> wrote:
> >
> > > Hi guys, another question about require js. So i experiment with
> creating
> > > a new source folder in eclipse by the name of requiresrc. Under that
> > folder
> > > will reside the META-INF/modules/my_javascript.js file. This way
> eclipse
> > > will deploy the META-INF/modules folder to the classes module
> > > automatically. It worked.
> > >
> > > The problem is when i change my_javascript.js file content. The content
> > > doesn't get refreshed automatically. Hitting F5 and Shift-F5 doesn't
> > change
> > > it too. But after a while (5-10 second) then the content will be
> changed
> > > automatically.
> > >
> > > Looking around i found this related thread
> > >
> >
> http://www.wenda.io/questions/4211439/force-refresh-doesnt-work-for-head-js.html
> > > basically it says that F5 wouldn't work because of the dynamic script
> > > loading. So, does anyone have a trick with this kind of thing? Because
> > I'm
> > > used of putting my js folder under WebApp folder and hitting refresh,
> > >  tapestry would pick up the new content. Restarting the app every time
> i
> > > change the js file would be a big pain.
> > >
> > > Thanks :)
> > >
> > > --
> > > http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
> > > twitter : @mreunionlabs @abangkis
> > > page : https://plus.google.com/104168782385184990771
> > >
> >
> >
> >
> > --
> > http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
> > twitter : @mreunionlabs @abangkis
> > page : https://plus.google.com/104168782385184990771
> >
>
>
>
> --
> Howard M. Lewis Ship
>
> Creator of Apache Tapestry
>
> The source for Tapestry training, mentoring and support. Contact me to
> learn how I can get you up and productive in Tapestry fast!
>
> (971) 678-5210
> http://howardlewisship.com
> @hlship
>



-- 
http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
twitter : @mreunionlabs @abangkis
page : https://plus.google.com/104168782385184990771

Re: Weird behaviour, require js doesn't refresh changed js file immediately

Posted by abangkis <ab...@gmail.com>.
thanks a lot Felix :)

On Fri, Mar 20, 2015 at 12:06 AM, Felix Scheffer <
fscheffer@felix-scheffer.de> wrote:

> Hi,
>
> for AMD modules, caching should be disabled by default.
>
> The default value for the Cache-Control header in this case is:
> "max-age=60,must-revalidate". You can customize that by setting
> SymbolConstants.OMIT_EXPIRATION_CACHE_CONTROL_HEADER.
>
> Hope that helps!
>
> Felix
>
>
> 2015-03-19 10:46 GMT+01:00 abangkis <ab...@gmail.com>:
>
> > Sorry to brought up old thread. Does anyone know where I can set up the
> > expiration time for require js module? Can I set it to zero or 1 second?
> >
> > Thanks.
> >
> >
> >
> > On Tue, Feb 10, 2015 at 10:21 PM, Howard Lewis Ship <hl...@gmail.com>
> > wrote:
> >
> > > For modules, which can't be fingerprinted with a checksum in the URL,
> > > Tapestry applies a short expiration time in development, and a much
> > longer
> > > one in production. I suspect you are hitting that.  A hard refresh,
> > > clearing the local cache, should force the browser to request the
> updated
> > > resource.
> > >
> > > Sometimes the browser just refuses to get the resource; you can see
> this
> > > when it looks one way in the browser, and differently and correctly via
> > > curl or httpie.
> > >
> > > On Sun, Feb 8, 2015 at 10:49 PM, abangkis <ab...@gmail.com> wrote:
> > >
> > > > Ok, my workaround is to add some kind of index number to log to
> > > javascript
> > > > console such as : console.log("29. Google map is ready"); I keep
> > > refreshing
> > > > until the number is changed. For now it's good enough but hopefully
> > > there's
> > > > a better solution in the future.
> > > >
> > > > On Sat, Feb 7, 2015 at 11:24 AM, abangkis <ab...@gmail.com>
> wrote:
> > > >
> > > > > Hi guys, another question about require js. So i experiment with
> > > creating
> > > > > a new source folder in eclipse by the name of requiresrc. Under
> that
> > > > folder
> > > > > will reside the META-INF/modules/my_javascript.js file. This way
> > > eclipse
> > > > > will deploy the META-INF/modules folder to the classes module
> > > > > automatically. It worked.
> > > > >
> > > > > The problem is when i change my_javascript.js file content. The
> > content
> > > > > doesn't get refreshed automatically. Hitting F5 and Shift-F5
> doesn't
> > > > change
> > > > > it too. But after a while (5-10 second) then the content will be
> > > changed
> > > > > automatically.
> > > > >
> > > > > Looking around i found this related thread
> > > > >
> > > >
> > >
> >
> http://www.wenda.io/questions/4211439/force-refresh-doesnt-work-for-head-js.html
> > > > > basically it says that F5 wouldn't work because of the dynamic
> script
> > > > > loading. So, does anyone have a trick with this kind of thing?
> > Because
> > > > I'm
> > > > > used of putting my js folder under WebApp folder and hitting
> refresh,
> > > > >  tapestry would pick up the new content. Restarting the app every
> > time
> > > i
> > > > > change the js file would be a big pain.
> > > > >
> > > > > Thanks :)
> > > > >
> > > > > --
> > > > > http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
> > > > > twitter : @mreunionlabs @abangkis
> > > > > page : https://plus.google.com/104168782385184990771
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
> > > > twitter : @mreunionlabs @abangkis
> > > > page : https://plus.google.com/104168782385184990771
> > > >
> > >
> > >
> > >
> > > --
> > > Howard M. Lewis Ship
> > >
> > > Creator of Apache Tapestry
> > >
> > > The source for Tapestry training, mentoring and support. Contact me to
> > > learn how I can get you up and productive in Tapestry fast!
> > >
> > > (971) 678-5210
> > > http://howardlewisship.com
> > > @hlship
> > >
> >
> >
> >
> > --
> > http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
> > twitter : @mreunionlabs @abangkis
> > page : https://plus.google.com/104168782385184990771
> >
>



-- 
http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
twitter : @mreunionlabs @abangkis
page : https://plus.google.com/104168782385184990771

Re: Weird behaviour, require js doesn't refresh changed js file immediately

Posted by Felix Scheffer <fs...@felix-scheffer.de>.
Hi,

for AMD modules, caching should be disabled by default.

The default value for the Cache-Control header in this case is:
"max-age=60,must-revalidate". You can customize that by setting
SymbolConstants.OMIT_EXPIRATION_CACHE_CONTROL_HEADER.

Hope that helps!

Felix


2015-03-19 10:46 GMT+01:00 abangkis <ab...@gmail.com>:

> Sorry to brought up old thread. Does anyone know where I can set up the
> expiration time for require js module? Can I set it to zero or 1 second?
>
> Thanks.
>
>
>
> On Tue, Feb 10, 2015 at 10:21 PM, Howard Lewis Ship <hl...@gmail.com>
> wrote:
>
> > For modules, which can't be fingerprinted with a checksum in the URL,
> > Tapestry applies a short expiration time in development, and a much
> longer
> > one in production. I suspect you are hitting that.  A hard refresh,
> > clearing the local cache, should force the browser to request the updated
> > resource.
> >
> > Sometimes the browser just refuses to get the resource; you can see this
> > when it looks one way in the browser, and differently and correctly via
> > curl or httpie.
> >
> > On Sun, Feb 8, 2015 at 10:49 PM, abangkis <ab...@gmail.com> wrote:
> >
> > > Ok, my workaround is to add some kind of index number to log to
> > javascript
> > > console such as : console.log("29. Google map is ready"); I keep
> > refreshing
> > > until the number is changed. For now it's good enough but hopefully
> > there's
> > > a better solution in the future.
> > >
> > > On Sat, Feb 7, 2015 at 11:24 AM, abangkis <ab...@gmail.com> wrote:
> > >
> > > > Hi guys, another question about require js. So i experiment with
> > creating
> > > > a new source folder in eclipse by the name of requiresrc. Under that
> > > folder
> > > > will reside the META-INF/modules/my_javascript.js file. This way
> > eclipse
> > > > will deploy the META-INF/modules folder to the classes module
> > > > automatically. It worked.
> > > >
> > > > The problem is when i change my_javascript.js file content. The
> content
> > > > doesn't get refreshed automatically. Hitting F5 and Shift-F5 doesn't
> > > change
> > > > it too. But after a while (5-10 second) then the content will be
> > changed
> > > > automatically.
> > > >
> > > > Looking around i found this related thread
> > > >
> > >
> >
> http://www.wenda.io/questions/4211439/force-refresh-doesnt-work-for-head-js.html
> > > > basically it says that F5 wouldn't work because of the dynamic script
> > > > loading. So, does anyone have a trick with this kind of thing?
> Because
> > > I'm
> > > > used of putting my js folder under WebApp folder and hitting refresh,
> > > >  tapestry would pick up the new content. Restarting the app every
> time
> > i
> > > > change the js file would be a big pain.
> > > >
> > > > Thanks :)
> > > >
> > > > --
> > > > http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
> > > > twitter : @mreunionlabs @abangkis
> > > > page : https://plus.google.com/104168782385184990771
> > > >
> > >
> > >
> > >
> > > --
> > > http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
> > > twitter : @mreunionlabs @abangkis
> > > page : https://plus.google.com/104168782385184990771
> > >
> >
> >
> >
> > --
> > Howard M. Lewis Ship
> >
> > Creator of Apache Tapestry
> >
> > The source for Tapestry training, mentoring and support. Contact me to
> > learn how I can get you up and productive in Tapestry fast!
> >
> > (971) 678-5210
> > http://howardlewisship.com
> > @hlship
> >
>
>
>
> --
> http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
> twitter : @mreunionlabs @abangkis
> page : https://plus.google.com/104168782385184990771
>

Re: Weird behaviour, require js doesn't refresh changed js file immediately

Posted by abangkis <ab...@gmail.com>.
Sorry to brought up old thread. Does anyone know where I can set up the
expiration time for require js module? Can I set it to zero or 1 second?

Thanks.



On Tue, Feb 10, 2015 at 10:21 PM, Howard Lewis Ship <hl...@gmail.com>
wrote:

> For modules, which can't be fingerprinted with a checksum in the URL,
> Tapestry applies a short expiration time in development, and a much longer
> one in production. I suspect you are hitting that.  A hard refresh,
> clearing the local cache, should force the browser to request the updated
> resource.
>
> Sometimes the browser just refuses to get the resource; you can see this
> when it looks one way in the browser, and differently and correctly via
> curl or httpie.
>
> On Sun, Feb 8, 2015 at 10:49 PM, abangkis <ab...@gmail.com> wrote:
>
> > Ok, my workaround is to add some kind of index number to log to
> javascript
> > console such as : console.log("29. Google map is ready"); I keep
> refreshing
> > until the number is changed. For now it's good enough but hopefully
> there's
> > a better solution in the future.
> >
> > On Sat, Feb 7, 2015 at 11:24 AM, abangkis <ab...@gmail.com> wrote:
> >
> > > Hi guys, another question about require js. So i experiment with
> creating
> > > a new source folder in eclipse by the name of requiresrc. Under that
> > folder
> > > will reside the META-INF/modules/my_javascript.js file. This way
> eclipse
> > > will deploy the META-INF/modules folder to the classes module
> > > automatically. It worked.
> > >
> > > The problem is when i change my_javascript.js file content. The content
> > > doesn't get refreshed automatically. Hitting F5 and Shift-F5 doesn't
> > change
> > > it too. But after a while (5-10 second) then the content will be
> changed
> > > automatically.
> > >
> > > Looking around i found this related thread
> > >
> >
> http://www.wenda.io/questions/4211439/force-refresh-doesnt-work-for-head-js.html
> > > basically it says that F5 wouldn't work because of the dynamic script
> > > loading. So, does anyone have a trick with this kind of thing? Because
> > I'm
> > > used of putting my js folder under WebApp folder and hitting refresh,
> > >  tapestry would pick up the new content. Restarting the app every time
> i
> > > change the js file would be a big pain.
> > >
> > > Thanks :)
> > >
> > > --
> > > http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
> > > twitter : @mreunionlabs @abangkis
> > > page : https://plus.google.com/104168782385184990771
> > >
> >
> >
> >
> > --
> > http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
> > twitter : @mreunionlabs @abangkis
> > page : https://plus.google.com/104168782385184990771
> >
>
>
>
> --
> Howard M. Lewis Ship
>
> Creator of Apache Tapestry
>
> The source for Tapestry training, mentoring and support. Contact me to
> learn how I can get you up and productive in Tapestry fast!
>
> (971) 678-5210
> http://howardlewisship.com
> @hlship
>



-- 
http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
twitter : @mreunionlabs @abangkis
page : https://plus.google.com/104168782385184990771

Re: Weird behaviour, require js doesn't refresh changed js file immediately

Posted by Howard Lewis Ship <hl...@gmail.com>.
For modules, which can't be fingerprinted with a checksum in the URL,
Tapestry applies a short expiration time in development, and a much longer
one in production. I suspect you are hitting that.  A hard refresh,
clearing the local cache, should force the browser to request the updated
resource.

Sometimes the browser just refuses to get the resource; you can see this
when it looks one way in the browser, and differently and correctly via
curl or httpie.

On Sun, Feb 8, 2015 at 10:49 PM, abangkis <ab...@gmail.com> wrote:

> Ok, my workaround is to add some kind of index number to log to javascript
> console such as : console.log("29. Google map is ready"); I keep refreshing
> until the number is changed. For now it's good enough but hopefully there's
> a better solution in the future.
>
> On Sat, Feb 7, 2015 at 11:24 AM, abangkis <ab...@gmail.com> wrote:
>
> > Hi guys, another question about require js. So i experiment with creating
> > a new source folder in eclipse by the name of requiresrc. Under that
> folder
> > will reside the META-INF/modules/my_javascript.js file. This way eclipse
> > will deploy the META-INF/modules folder to the classes module
> > automatically. It worked.
> >
> > The problem is when i change my_javascript.js file content. The content
> > doesn't get refreshed automatically. Hitting F5 and Shift-F5 doesn't
> change
> > it too. But after a while (5-10 second) then the content will be changed
> > automatically.
> >
> > Looking around i found this related thread
> >
> http://www.wenda.io/questions/4211439/force-refresh-doesnt-work-for-head-js.html
> > basically it says that F5 wouldn't work because of the dynamic script
> > loading. So, does anyone have a trick with this kind of thing? Because
> I'm
> > used of putting my js folder under WebApp folder and hitting refresh,
> >  tapestry would pick up the new content. Restarting the app every time i
> > change the js file would be a big pain.
> >
> > Thanks :)
> >
> > --
> > http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
> > twitter : @mreunionlabs @abangkis
> > page : https://plus.google.com/104168782385184990771
> >
>
>
>
> --
> http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
> twitter : @mreunionlabs @abangkis
> page : https://plus.google.com/104168782385184990771
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com
@hlship

Re: Weird behaviour, require js doesn't refresh changed js file immediately

Posted by abangkis <ab...@gmail.com>.
Ok, my workaround is to add some kind of index number to log to javascript
console such as : console.log("29. Google map is ready"); I keep refreshing
until the number is changed. For now it's good enough but hopefully there's
a better solution in the future.

On Sat, Feb 7, 2015 at 11:24 AM, abangkis <ab...@gmail.com> wrote:

> Hi guys, another question about require js. So i experiment with creating
> a new source folder in eclipse by the name of requiresrc. Under that folder
> will reside the META-INF/modules/my_javascript.js file. This way eclipse
> will deploy the META-INF/modules folder to the classes module
> automatically. It worked.
>
> The problem is when i change my_javascript.js file content. The content
> doesn't get refreshed automatically. Hitting F5 and Shift-F5 doesn't change
> it too. But after a while (5-10 second) then the content will be changed
> automatically.
>
> Looking around i found this related thread
> http://www.wenda.io/questions/4211439/force-refresh-doesnt-work-for-head-js.html
> basically it says that F5 wouldn't work because of the dynamic script
> loading. So, does anyone have a trick with this kind of thing? Because I'm
> used of putting my js folder under WebApp folder and hitting refresh,
>  tapestry would pick up the new content. Restarting the app every time i
> change the js file would be a big pain.
>
> Thanks :)
>
> --
> http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
> twitter : @mreunionlabs @abangkis
> page : https://plus.google.com/104168782385184990771
>



-- 
http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
twitter : @mreunionlabs @abangkis
page : https://plus.google.com/104168782385184990771