Merge pull request #3331 from Budibase/fix/browser-caching
bust cache when app versions are different
This commit is contained in:
commit
c4fb7ff8ff
|
@ -197,7 +197,7 @@ exports.fetchAppPackage = async ctx => {
|
||||||
application,
|
application,
|
||||||
screens,
|
screens,
|
||||||
layouts,
|
layouts,
|
||||||
clientLibPath: clientLibraryPath(ctx.params.appId),
|
clientLibPath: clientLibraryPath(ctx.params.appId, application.version),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,7 @@ exports.serveApp = async function (ctx) {
|
||||||
title: appInfo.name,
|
title: appInfo.name,
|
||||||
production: env.isProd(),
|
production: env.isProd(),
|
||||||
appId,
|
appId,
|
||||||
clientLibPath: clientLibraryPath(appId),
|
clientLibPath: clientLibraryPath(appId, appInfo.version),
|
||||||
})
|
})
|
||||||
|
|
||||||
const appHbs = loadHandlebarsFile(`${__dirname}/templates/app.hbs`)
|
const appHbs = loadHandlebarsFile(`${__dirname}/templates/app.hbs`)
|
||||||
|
|
|
@ -51,11 +51,16 @@ exports.objectStoreUrl = () => {
|
||||||
* @return {string} The URL to be inserted into appPackage response or server rendered
|
* @return {string} The URL to be inserted into appPackage response or server rendered
|
||||||
* app index file.
|
* app index file.
|
||||||
*/
|
*/
|
||||||
exports.clientLibraryPath = appId => {
|
exports.clientLibraryPath = (appId, version) => {
|
||||||
if (env.isProd()) {
|
if (env.isProd()) {
|
||||||
return `${exports.objectStoreUrl()}/${sanitizeKey(
|
let url = `${exports.objectStoreUrl()}/${sanitizeKey(
|
||||||
appId
|
appId
|
||||||
)}/budibase-client.js`
|
)}/budibase-client.js`
|
||||||
|
// append app version to bust the cache
|
||||||
|
if (version) {
|
||||||
|
url += `?v=${version}`
|
||||||
|
}
|
||||||
|
return url
|
||||||
} else {
|
} else {
|
||||||
return `/api/assets/client`
|
return `/api/assets/client`
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue