Skip to content

Commit

Permalink
Merge pull request #8350 from kidroca/kidroca/fix/version-check-is-ca…
Browse files Browse the repository at this point in the history
…ched

Always request version.json from network (no cache)
  • Loading branch information
luacmartins authored Mar 30, 2022
2 parents c27c4b1 + d89a148 commit 9b825b4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 21 deletions.
2 changes: 1 addition & 1 deletion config/webpack/webpack.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module.exports = (env = {}) => {
mode: 'development',
devtool: 'inline-source-map',
devServer: {
contentBase: path.join(__dirname, '../dist'),
contentBase: path.join(__dirname, '../../dist'),
hot: true,
...proxySettings,
historyApiFallback: true,
Expand Down
18 changes: 0 additions & 18 deletions src/libs/HttpUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,23 +59,6 @@ function xhr(command, data, type = CONST.NETWORK.METHOD.POST, shouldUseSecure =
return processHTTPRequest(`${apiRoot}api?command=${command}`, type, formData, data.canCancel);
}

/**
* Just download a file from the web server.
*
* @param {String} relativePath From the website root, NOT the API root. (no leading slash, ., or ..)
* @returns {Promise}
*/
function download(relativePath) {
const siteRoot = CONFIG.EXPENSIFY.NEW_EXPENSIFY_URL;

// Strip leading slashes and periods from relative path, if present
const strippedRelativePath = relativePath.charAt(0) === '/' || relativePath.charAt(0) === '.'
? relativePath.slice(relativePath.indexOf('/') + 1)
: relativePath;

return processHTTPRequest(`${siteRoot}${strippedRelativePath}`);
}

function cancelPendingRequests() {
cancellationController.abort();

Expand All @@ -85,7 +68,6 @@ function cancelPendingRequests() {
}

export default {
download,
xhr,
cancelPendingRequests,
};
4 changes: 2 additions & 2 deletions src/setup/platformSetup/index.website.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import 'shim-keyboard-event-key';

import checkForUpdates from '../../libs/checkForUpdates';
import Config from '../../CONFIG';
import HttpUtils from '../../libs/HttpUtils';
import DateUtils from '../../libs/DateUtils';
import {version as currentVersion} from '../../../package.json';
import Visibility from '../../libs/Visibility';
Expand All @@ -15,7 +14,8 @@ import Visibility from '../../libs/Visibility';
* then refresh. If the page is visibile, prompt the user to refresh.
*/
function webUpdate() {
HttpUtils.download('version.json')
fetch('/version.json', {cache: 'no-cache'})
.then(response => response.json())
.then(({version}) => {
if (version === currentVersion) {
return;
Expand Down

0 comments on commit 9b825b4

Please sign in to comment.