Create load_queue before we attempt token to prevent stunned UI

This commit is contained in:
James Barnsley
2018-10-19 16:12:26 +13:00
parent fdce2b08cb
commit a14d021209
4 changed files with 16 additions and 12 deletions

View File

@ -3251,6 +3251,12 @@ var request = function request(dispatch, getState, endpoint) {
var data = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
// Add reference to loader queue
// We do this straight away so that even if we're refreshing the token, it still registers as
// loading said endpoint
var loader_key = helpers.generateGuid();
dispatch(uiActions.startLoading(loader_key, 'spotify_' + endpoint));
return new Promise(function (resolve, reject) {
getToken(dispatch, getState).then(function (response) {
@ -3280,10 +3286,6 @@ var request = function request(dispatch, getState, endpoint) {
}
}
// add reference to loader queue
var loader_key = helpers.generateGuid();
dispatch(uiActions.startLoading(loader_key, 'spotify_' + endpoint));
$.ajax(config).then(function (response) {
dispatch(uiActions.stopLoading(loader_key));
resolve(response);
@ -70456,7 +70458,7 @@ var Track = function (_React$Component) {
if (nextProps.params.uri != this.props.params.uri) {
this.props.coreActions.loadTrack(nextProps.params.uri);
if (nextProps.tracks.artists) {
if (nextProps.genius_authorized && nextProps.tracks.artists) {
this.props.geniusActions.findTrackLyrics(nextProps.track);
}
@ -81500,7 +81502,7 @@ var LibraryArtists = function (_React$Component) {
if (newProps.spotify_enabled && (newProps.source == 'all' || newProps.source == 'spotify')) {
// Filter changed, but we haven't got this provider's library yet
if (!newProps.spotify_library_artists_status != 'finished' && newProps.spotify_library_artists_status != 'started') {
if (!newProps.spotify_library_artists_status != 'finished' && newProps.spotify_library_artists_status != 'started' && newProps.spotify_library_artists_status != 'running') {
this.props.spotifyActions.getLibraryArtists();
}
}

File diff suppressed because one or more lines are too long

View File

@ -98,7 +98,7 @@
// Release details
// These are automatically injected to built HTML
var build = "1539803755";
var build = "1539892246";
var version = "3.28.1";
// Construct the script tag

View File

@ -17,6 +17,12 @@ var helpers = require('../../helpers')
**/
const request = (dispatch, getState, endpoint, method = 'GET', data = false) => {
// Add reference to loader queue
// We do this straight away so that even if we're refreshing the token, it still registers as
// loading said endpoint
var loader_key = helpers.generateGuid()
dispatch(uiActions.startLoading(loader_key, 'spotify_'+endpoint));
return new Promise((resolve, reject) => {
getToken(dispatch, getState)
.then(
@ -49,10 +55,6 @@ const request = (dispatch, getState, endpoint, method = 'GET', data = false) =>
}
}
// add reference to loader queue
var loader_key = helpers.generateGuid()
dispatch(uiActions.startLoading(loader_key, 'spotify_'+endpoint));
$.ajax(config).then(
response => {
dispatch(uiActions.stopLoading(loader_key))