diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-20 16:18:24 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-20 16:18:24 +0300 |
commit | 0653e08efd039a5905f3fa4f6e9cef9f5d2f799c (patch) | |
tree | 4dcc884cf6d81db44adae4aa99f8ec1233a41f55 /app/assets/javascripts/diffs/store/actions.js | |
parent | 744144d28e3e7fddc117924fef88de5d9674fe4c (diff) |
Add latest changes from gitlab-org/gitlab@14-3-stable-eev14.3.0-rc42
Diffstat (limited to 'app/assets/javascripts/diffs/store/actions.js')
-rw-r--r-- | app/assets/javascripts/diffs/store/actions.js | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/app/assets/javascripts/diffs/store/actions.js b/app/assets/javascripts/diffs/store/actions.js index f7bdbe94bac..5c94c6b803b 100644 --- a/app/assets/javascripts/diffs/store/actions.js +++ b/app/assets/javascripts/diffs/store/actions.js @@ -29,9 +29,6 @@ import { EVT_PERF_MARK_FILE_TREE_START, EVT_PERF_MARK_FILE_TREE_END, EVT_PERF_MARK_DIFF_FILES_START, - DIFF_VIEW_FILE_BY_FILE, - DIFF_VIEW_ALL_FILES, - DIFF_FILE_BY_FILE_COOKIE_NAME, TRACKING_CLICK_DIFF_VIEW_SETTING, TRACKING_DIFF_VIEW_INLINE, TRACKING_DIFF_VIEW_PARALLEL, @@ -104,7 +101,7 @@ export const fetchDiffFilesBatch = ({ commit, state, dispatch }) => { let totalLoaded = 0; let scrolledVirtualScroller = false; - commit(types.SET_BATCH_LOADING, true); + commit(types.SET_BATCH_LOADING_STATE, 'loading'); commit(types.SET_RETRIEVING_BATCHES, true); eventHub.$emit(EVT_PERF_MARK_DIFF_FILES_START); @@ -115,7 +112,7 @@ export const fetchDiffFilesBatch = ({ commit, state, dispatch }) => { totalLoaded += diff_files.length; commit(types.SET_DIFF_DATA_BATCH, { diff_files }); - commit(types.SET_BATCH_LOADING, false); + commit(types.SET_BATCH_LOADING_STATE, 'loaded'); if (window.gon?.features?.diffsVirtualScrolling && !scrolledVirtualScroller) { const index = state.diffFiles.findIndex( @@ -130,7 +127,7 @@ export const fetchDiffFilesBatch = ({ commit, state, dispatch }) => { } if (!isNoteLink && !state.currentDiffFileId) { - commit(types.VIEW_DIFF_FILE, diff_files[0].file_hash); + commit(types.VIEW_DIFF_FILE, diff_files[0]?.file_hash); } if (isNoteLink) { @@ -182,11 +179,14 @@ export const fetchDiffFilesBatch = ({ commit, state, dispatch }) => { return null; }) - .catch(() => commit(types.SET_RETRIEVING_BATCHES, false)); + .catch(() => { + commit(types.SET_RETRIEVING_BATCHES, false); + commit(types.SET_BATCH_LOADING_STATE, 'error'); + }); - return getBatch() - .then(() => !window.gon?.features?.diffsVirtualScrolling && handleLocationHash()) - .catch(() => null); + return getBatch().then( + () => !window.gon?.features?.diffsVirtualScrolling && handleLocationHash(), + ); }; export const fetchDiffFilesMeta = ({ commit, state }) => { @@ -816,9 +816,7 @@ export const navigateToDiffFileIndex = ({ commit, state }, index) => { }; export const setFileByFile = ({ state, commit }, { fileByFile }) => { - const fileViewMode = fileByFile ? DIFF_VIEW_FILE_BY_FILE : DIFF_VIEW_ALL_FILES; commit(types.SET_FILE_BY_FILE, fileByFile); - Cookies.set(DIFF_FILE_BY_FILE_COOKIE_NAME, fileViewMode); if (window.gon?.features?.diffSettingsUsageData) { const events = [TRACKING_CLICK_SINGLE_FILE_SETTING]; |