fix: load the list tasks only after the list itself was loaded

This commit is contained in:
kolaente 2021-12-26 18:44:50 +01:00
parent 7e8e26679c
commit faf8f2b1a5
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
2 changed files with 19 additions and 6 deletions

View File

@ -165,6 +165,11 @@ store.dispatch('labels/loadAllLabels')
.app-content {
padding: $navbar-height + 1.5rem 1.5rem 1rem 1.5rem;
z-index: 2;
// Used to make sure the spinner is always in the middle while loading
> .loader-container {
min-height: calc(100vh - #{$navbar-height + 1.5rem + 1rem});
}
@media screen and (max-width: $tablet) {
margin-left: 0;

View File

@ -41,17 +41,17 @@
</message>
</transition>
<router-view/>
<router-view v-if="listLoaded"/>
</div>
</template>
<script>
import Message from '@/components/misc/message'
import ListModel from '../../models/list'
import ListService from '../../services/list'
import {CURRENT_LIST} from '../../store/mutation-types'
import {getListView} from '../../helpers/saveListView'
import {saveListToHistory} from '../../modules/listHistory'
import ListModel from '@/models/list'
import ListService from '@/services/list'
import {CURRENT_LIST, BACKGROUND} from '@/store/mutation-types'
import {getListView} from '@/helpers/saveListView'
import {saveListToHistory} from '@/modules/listHistory'
export default {
components: {Message},
@ -96,6 +96,7 @@ export default {
return
}
this.listLoaded = 0
const listData = {id: parseInt(this.$route.params.listId)}
saveListToHistory(listData)
@ -144,6 +145,13 @@ export default {
}
console.debug(`Loading list, $route.name = ${this.$route.name}, $route.params =`, this.$route.params, `, listLoaded = ${this.listLoaded}, currentList = `, this.currentList)
// Put set the current list to the one we're about to load so that the title is already shown at the top
const listFromStore = this.$store.getters['lists/getListById'](listData.id)
if (listFromStore !== null) {
this.$store.commit(BACKGROUND, null)
this.$store.commit(CURRENT_LIST, listFromStore)
}
// We create an extra list object instead of creating it in this.list because that would trigger a ui update which would result in bad ux.
const list = new ListModel(listData)