Update UI before API, to speed it up.

This commit is contained in:
Matthew Stratford 2020-09-25 20:57:48 +01:00
parent ab3927a527
commit 4f4533b4bb

View file

@ -66,8 +66,8 @@ const setTrackIntro = (
player: number player: number
): AppThunk => async (dispatch) => { ): AppThunk => async (dispatch) => {
try { try {
await api.setTrackIntro(track.trackid, secs);
dispatch(MixerState.setLoadedItemIntro(player, secs)); dispatch(MixerState.setLoadedItemIntro(player, secs));
await api.setTrackIntro(track.trackid, secs);
dispatch(ShowPlanState.setItemTimings({ item: track, intro: secs })); dispatch(ShowPlanState.setItemTimings({ item: track, intro: secs }));
} catch (e) { } catch (e) {
console.error(e); console.error(e);
@ -80,8 +80,8 @@ const setTrackOutro = (
player: number player: number
): AppThunk => async (dispatch) => { ): AppThunk => async (dispatch) => {
try { try {
await api.setTrackOutro(track.trackid, secs);
dispatch(MixerState.setLoadedItemOutro(player, secs)); dispatch(MixerState.setLoadedItemOutro(player, secs));
await api.setTrackOutro(track.trackid, secs);
dispatch(ShowPlanState.setItemTimings({ item: track, outro: secs })); dispatch(ShowPlanState.setItemTimings({ item: track, outro: secs }));
} catch (e) { } catch (e) {
console.error(e); console.error(e);
@ -94,8 +94,8 @@ const setTrackCue = (
player: number player: number
): AppThunk => async (dispatch) => { ): AppThunk => async (dispatch) => {
try { try {
await api.setTimeslotItemCue(item.timeslotitemid, secs);
dispatch(MixerState.setLoadedItemCue(player, secs)); dispatch(MixerState.setLoadedItemCue(player, secs));
await api.setTimeslotItemCue(item.timeslotitemid, secs);
dispatch(ShowPlanState.setItemTimings({ item, cue: secs })); dispatch(ShowPlanState.setItemTimings({ item, cue: secs }));
} catch (e) { } catch (e) {
console.error(e); console.error(e);