Commit 7e69d614 authored by André Luís's avatar André Luís Committed by André Luís

Keep large spinner while MR file tree is loading

parent 6b120d08
...@@ -127,7 +127,13 @@ export default { ...@@ -127,7 +127,13 @@ export default {
emailPatchPath: state => state.diffs.emailPatchPath, emailPatchPath: state => state.diffs.emailPatchPath,
retrievingBatches: state => state.diffs.retrievingBatches, retrievingBatches: state => state.diffs.retrievingBatches,
}), }),
...mapState('diffs', ['showTreeList', 'isLoading', 'startVersion', 'currentDiffFileId']), ...mapState('diffs', [
'showTreeList',
'isLoading',
'startVersion',
'currentDiffFileId',
'isTreeLoaded',
]),
...mapGetters('diffs', ['isParallelView', 'currentDiffIndex']), ...mapGetters('diffs', ['isParallelView', 'currentDiffIndex']),
...mapGetters(['isNotesFetched', 'getNoteableData']), ...mapGetters(['isNotesFetched', 'getNoteableData']),
diffs() { diffs() {
...@@ -400,7 +406,7 @@ export default { ...@@ -400,7 +406,7 @@ export default {
<template> <template>
<div v-show="shouldShow"> <div v-show="shouldShow">
<div v-if="isLoading" class="loading"><gl-loading-icon size="lg" /></div> <div v-if="isLoading || !isTreeLoaded" class="loading"><gl-loading-icon size="lg" /></div>
<div v-else id="diffs" :class="{ active: shouldShow }" class="diffs tab-pane"> <div v-else id="diffs" :class="{ active: shouldShow }" class="diffs tab-pane">
<compare-versions <compare-versions
:merge-request-diffs="mergeRequestDiffs" :merge-request-diffs="mergeRequestDiffs"
......
...@@ -15,6 +15,7 @@ const whiteSpaceFromCookie = Cookies.get(DIFF_WHITESPACE_COOKIE_NAME); ...@@ -15,6 +15,7 @@ const whiteSpaceFromCookie = Cookies.get(DIFF_WHITESPACE_COOKIE_NAME);
export default () => ({ export default () => ({
isLoading: true, isLoading: true,
isTreeLoaded: false,
isBatchLoading: false, isBatchLoading: false,
retrievingBatches: false, retrievingBatches: false,
addedLines: null, addedLines: null,
......
...@@ -323,6 +323,7 @@ export default { ...@@ -323,6 +323,7 @@ export default {
[types.SET_TREE_DATA](state, { treeEntries, tree }) { [types.SET_TREE_DATA](state, { treeEntries, tree }) {
state.treeEntries = treeEntries; state.treeEntries = treeEntries;
state.tree = tree; state.tree = tree;
state.isTreeLoaded = true;
}, },
[types.SET_RENDER_TREE_LIST](state, renderTreeList) { [types.SET_RENDER_TREE_LIST](state, renderTreeList) {
state.renderTreeList = renderTreeList; state.renderTreeList = renderTreeList;
......
---
title: Keep large spinner while MR file tree is loading
merge_request: 36446
author:
type: fixed
...@@ -41,6 +41,7 @@ describe('diffs/components/app', () => { ...@@ -41,6 +41,7 @@ describe('diffs/components/app', () => {
store = createDiffsStore(); store = createDiffsStore();
store.state.diffs.isLoading = false; store.state.diffs.isLoading = false;
store.state.diffs.isTreeLoaded = true;
extendStore(store); extendStore(store);
......
...@@ -17,6 +17,7 @@ describe('Diffs tree list component', () => { ...@@ -17,6 +17,7 @@ describe('Diffs tree list component', () => {
}); });
// Setup initial state // Setup initial state
store.state.diffs.isTreeLoaded = true;
store.state.diffs.diffFiles.push('test'); store.state.diffs.diffFiles.push('test');
store.state.diffs = { store.state.diffs = {
addedLines: 10, addedLines: 10,
......
...@@ -830,6 +830,7 @@ describe('DiffsStoreMutations', () => { ...@@ -830,6 +830,7 @@ describe('DiffsStoreMutations', () => {
const state = { const state = {
treeEntries: {}, treeEntries: {},
tree: [], tree: [],
isTreeLoaded: false,
}; };
mutations[types.SET_TREE_DATA](state, { mutations[types.SET_TREE_DATA](state, {
...@@ -844,6 +845,7 @@ describe('DiffsStoreMutations', () => { ...@@ -844,6 +845,7 @@ describe('DiffsStoreMutations', () => {
}); });
expect(state.tree).toEqual(['tree']); expect(state.tree).toEqual(['tree']);
expect(state.isTreeLoaded).toEqual(true);
}); });
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment