From e32c9afddae28e10c4e31724bcc7c8837b0a7b97 Mon Sep 17 00:00:00 2001 From: Fatih Acet Date: Mon, 2 Jul 2018 21:21:33 +0200 Subject: Reload MR page when diff view mode changed. This is a temp change. See #48666 for more details. --- app/assets/javascripts/diffs/store/actions.js | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/diffs/store/actions.js b/app/assets/javascripts/diffs/store/actions.js index 5e0fd5109bb..f3471e23e8b 100644 --- a/app/assets/javascripts/diffs/store/actions.js +++ b/app/assets/javascripts/diffs/store/actions.js @@ -30,19 +30,31 @@ export const fetchDiffFiles = ({ state, commit }) => { }; export const setInlineDiffViewType = ({ commit }) => { - commit(types.SET_DIFF_VIEW_TYPE, INLINE_DIFF_VIEW_TYPE); - Cookies.set(DIFF_VIEW_COOKIE_NAME, INLINE_DIFF_VIEW_TYPE); const url = mergeUrlParams({ view: INLINE_DIFF_VIEW_TYPE }, window.location.href); - historyPushState(url); + + // This is a temporarily workaround for performance issues + if (process.env.NODE_ENV !== 'test') { + historyPushState(url); + commit(types.SET_DIFF_VIEW_TYPE, INLINE_DIFF_VIEW_TYPE); + } + + // For some performance issues we reload the page. See #48666 for more details. + document.location.href = url; }; export const setParallelDiffViewType = ({ commit }) => { - commit(types.SET_DIFF_VIEW_TYPE, PARALLEL_DIFF_VIEW_TYPE); - Cookies.set(DIFF_VIEW_COOKIE_NAME, PARALLEL_DIFF_VIEW_TYPE); const url = mergeUrlParams({ view: PARALLEL_DIFF_VIEW_TYPE }, window.location.href); - historyPushState(url); + + // This is a temporarily workaround for performance issues + if (process.env.NODE_ENV !== 'test') { + commit(types.SET_DIFF_VIEW_TYPE, PARALLEL_DIFF_VIEW_TYPE); + historyPushState(url); + } + + // For some performance issues we reload the page. See #48666 for more details. + document.location.href = url; }; export const showCommentForm = ({ commit }, params) => { -- cgit v1.2.1