[KULRICE-7357] Handle naming of JS files to avoid problems caused by cached JS files Created: 22/May/12  Updated: 03/Apr/13  Resolved: 14/Aug/12

Status: Closed
Project: Kuali Rice Development
Component/s: Development
Affects Version/s: None
Fix Version/s: 2.2.0-m4, 2.2
Security Level: Public (Public: Anyone can view)

Type: Task Priority: Major
Reporter: Cassy Beekman (Inactive) Assignee: Matthew Wuertz (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Similar issues:
KULRICE-6417License header update causing syntax problems in JS files
KULRICE-8400JS error in adding note/attachment
KULRICE-8690Uif-BaseTheme-parentBean defaults to minimized js which are difficult to debug
KULRICE-11453Maintenance Conversion Script - M22 Additional JS File
KULRICE-6438Create folder structure for custom, library and modified library js files
KULRICE-9827Split Js files further into other functional areas
KULRICE-3985portalTop tag only works with a single portal CSS/JS file
KULRICE-5330Web files (css and JS) need to be combined and minified for war production deployment
KULRICE-8155JS error going to collections page
KULRICE-9608URL updating for back button support causes problems with resource caching
Rice Module:
KRAD
KAI Review Status: Not Required
KTI Review Status: Not Required

 Description   

When ks-1.3 was upgraded to Rice 2.2.0, we found that all of our devs and testers had to manually clear their browser caches, because the Rice upgrade depended upon changes in the JS files that were not being pulled in due to caching.

Garey mentioned this in the KS Devs as a possible way to handle this:

[5/21/2012 10:07:10 AM] Garey: Yeah, it's caching. So, with the Rice upgrade I think some of the underlying js files were changed. JS files are permanently cached. GWT got around this by generating all js file names at compile time based off of a hash code, which ensured you never used stale / cached classes.
[5/21/2012 10:08:08 AM] Garey: Note: this will be a a BIG pain for users in the future.



 Comments   
Comment by Jerry Neal (Inactive) [ 22/May/12 ]

Cassy,

We can due this but I am wondering if the development side is that big of a problem? For users, we have minified CSS and JS files that get generated. We can add a hash so those get downloaded for a new release. For the individual files that developers use, we would need to write something that modified the file names and all the includes, which would be a bit of work and probably low priority compared to other issues.

So just wanted to see if you agreed the user part is the critical issue, and for developers not as much?

thanks,
Jerry

Comment by Cassy Beekman (Inactive) [ 22/May/12 ]

Hi Jerry, thanks for asking. Yes, agree that it is really the users that we're concerned about. If you have a working solution for them, feel free to downgrade or resolve this one. Thanks!

Comment by Jerry Neal (Inactive) [ 03/Jul/12 ]

Matt,

For this one here is what we need to do:

1) Verify we have all our JS and CSS files listed for the minimize plugin and in the correct order
2) For the generated JS and CSS min files, add the Rice version to the name. You should be able to reference the maven variable $

{project.version}

. This will give our files a new name each release which will force a download

After this is in place, let's go ahead and change the theme (UifViewPageDefinitions.xml) to use the minified files by default so we are testing this configuration.

thanks,
Jerry

Comment by Eric Westfall [ 02/Aug/12 ]

One article I read talked about using an MD5 hash of the JS file in the name which sounds like a clever approach as it would only change when the contents of the JS file change. Using the version number would work but wouldn't help developers since it's always going to be some snapshot version. The MD5 approach might be more challenging to implement though.

Comment by Travis Schneeberger [ 02/Aug/12 ]

Eric,

Naming based on MD5 is what GWT does with JavaScript files. see: https://developers.google.com/web-toolkit/doc/latest/FAQ_DebuggingAndCompiling

Specifically, I'm referring to the "cache" files.

Comment by Matthew Wuertz (Inactive) [ 14/Aug/12 ]

Per Jerry, I changed the files to include the project version in the name. Also, I reordered some of the files so that they would function correctly in minified format.

Generated at Wed Apr 08 21:46:58 CDT 2020 using JIRA 6.1.5#6160-sha1:a61a0fc278117a0da0ec9b89167b8f29b6afdab2.