Uploaded image for project: 'Kuali Rice Development'
  1. Kuali Rice Development
  2. KULRICE-7357

Handle naming of JS files to avoid problems caused by cached JS files

    Details

    • Type: Task
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.2.0-m4, 2.2
    • Component/s: Development
    • Security Level: Public (Public: Anyone can view)
    • Labels:
      None
    • 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.

        Attachments

          Activity

          Hide
          jkneal Jerry Neal (Inactive) added a comment -

          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

          Show
          jkneal Jerry Neal (Inactive) added a comment - 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
          Hide
          cbeekman Cassy Beekman (Inactive) added a comment -

          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!

          Show
          cbeekman Cassy Beekman (Inactive) added a comment - 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!
          Hide
          jkneal Jerry Neal (Inactive) added a comment -

          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

          Show
          jkneal Jerry Neal (Inactive) added a comment - 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
          Hide
          ewestfal Eric Westfall added a comment -

          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.

          Show
          ewestfal Eric Westfall added a comment - 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.
          Hide
          tschneeb Travis Schneeberger added a comment -

          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.

          Show
          tschneeb Travis Schneeberger added a comment - 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.
          Hide
          matthew.wuertz Matthew Wuertz (Inactive) added a comment -

          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.

          Show
          matthew.wuertz Matthew Wuertz (Inactive) added a comment - 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.

            People

            • Assignee:
              matthew.wuertz Matthew Wuertz (Inactive)
              Reporter:
              cbeekman Cassy Beekman (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: