1
0
Fork 0
mirror of synced 2024-06-23 08:30:31 +12:00

bust cache when app versions are different

This commit is contained in:
Martin McKeaveney 2021-11-11 12:21:45 +01:00
parent 0202adaa60
commit 3915f3d993
2 changed files with 8 additions and 3 deletions

View file

@ -87,7 +87,7 @@ exports.serveApp = async function (ctx) {
title: appInfo.name,
production: env.isProd(),
appId,
clientLibPath: clientLibraryPath(appId),
clientLibPath: clientLibraryPath(appId, appInfo.version),
})
const appHbs = loadHandlebarsFile(`${__dirname}/templates/app.hbs`)

View file

@ -51,11 +51,16 @@ exports.objectStoreUrl = () => {
* @return {string} The URL to be inserted into appPackage response or server rendered
* app index file.
*/
exports.clientLibraryPath = appId => {
exports.clientLibraryPath = (appId, version) => {
if (env.isProd()) {
return `${exports.objectStoreUrl()}/${sanitizeKey(
let url = `${exports.objectStoreUrl()}/${sanitizeKey(
appId
)}/budibase-client.js`
// append app version to bust the cache
if (version) {
url += `?v=${version}`
}
return url
} else {
return `/api/assets/client`
}