Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always request version.json from network (no cache) #8350

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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())
luacmartins marked this conversation as resolved.
Show resolved Hide resolved
.then(({version}) => {
if (version === currentVersion) {
return;
Expand Down