3

I have an Excel office add-in in app source.

I fixed a bug which a user has reported to me and now I want to deploy that fix.

This required a change in the .js files only, no change to the manifest file or any of the html pages for the taskpanes.

Updating the .js file on the server, even with caching disabled on the server endpoint won't trigger the add-in to reload the sources, they continue to be cached (from memory or from disk) according to the Edge DevTools debugger.

I have double checked that this file is different and, when I open the link in a browser and check the network tab in the web console I am getting a 200 response when I load it for the first time after updating, then 304 after that.

I can direct the user to reset the cache through file > options > trust center > trusted add-in catalogs > check the box that says "Next time Office starts, clear all previously-started web add-ins cache" > restart Excel > insert > my add-ins > add "the add-in", but this will only help one user, I want this to work for all users, obviously.

What am I missing here? Do I need to do something in app source? I can resubmit the add-in with an incremented version? But how long will that take for approval?

Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45

4 Answers4

2

As it turned out, the problem was the wordpress fast cache plugin. This was disabled using htaccess on the server.

Now the request headers are coming through as:

cache-control: max-age=0, no-cache, no-store, must-revalidate,
...,
pragma: no-cache

I needed to reset the cache as mentioned above for this to take effect.

  • I'm curious how you are using Wordpress to host a JS Add-In? Is it like a Website to 'promote/explain' add-in that also hosts the files on the backend? – FreeSoftwareServers Jun 13 '22 at 22:17
  • Kind of, actually the add-in is a small part of our product. It links our API to Excel; we're a SaaS company. The public webpage is built using wordpress and since the files needed to be publicly available they had to be put in there. We're not hosted by wordpress, just using their platform I guess. I'm not 100% on the details as that's not part of my job. – BrendanOtherwhyz Jun 14 '22 at 23:45
  • Nope that sounds about right, any webserver will do and if your allready running wordpress, no reason not to use the same domain. One thing using a backend opens up so many possibilities but the add-ins like to be same domain. – FreeSoftwareServers Jun 15 '22 at 00:27
1

Try renaming the file. Also, be sure to rename references to it, such as inside <script> tags. If you are using Webpack, it is easy to do all this automatically.

Rick Kirkham
  • 9,038
  • 1
  • 14
  • 32
  • Renaming files is no good for version history, which is imperative when coding. I had to side-step my Webpack renaming of files using a batch script, but I did read that this is why Webpack does it/why Excel Add-In uses it. – FreeSoftwareServers Jun 13 '22 at 22:16
0

When you say you updated the .js file, did you change this in the src or the dist folder? May be a case of needing to rebuild the project ie npm run build?

RichS3
  • 59
  • 2
  • I am updating the .js file on the server using ftp, it's in the dist folder and it is definitely different to the previous version. – BrendanOtherwhyz May 10 '22 at 12:32
0

Currently I am facing similar situation, and used renaming as suggested in answer above. I have written a script to rename files and there references in html/script files using them. below are simple steps I followed.

  1. Publish project with original file names.
  2. Generate a GUID, and rename all script files by adding it at end of filename.
  3. Iterate through all html/js files and search for script tags with source as old file name and replace it with new filename (originalname+GUID).
Kashif
  • 85
  • 8