Merge pull request #5281 from nextcloud/perf/initial-state

This commit is contained in:
Julius Härtl
2023-11-13 15:17:04 +01:00
committed by GitHub
10 changed files with 139 additions and 49 deletions

View File

@@ -49,6 +49,7 @@ import AppNavigation from './components/navigation/AppNavigation.vue'
import { NcModal, NcContent, NcAppContent } from '@nextcloud/vue'
import { BoardApi } from './services/BoardApi.js'
import { emit, subscribe } from '@nextcloud/event-bus'
import { loadState } from '@nextcloud/initial-state'
const boardApi = new BoardApi()
@@ -108,7 +109,10 @@ export default {
},
},
created() {
this.$store.dispatch('loadBoards')
const initialState = loadState('deck', 'initialBoards', null)
if (initialState !== null) {
this.$store.dispatch('loadBoards')
}
this.$store.dispatch('loadSharees')
},
mounted() {

View File

@@ -89,5 +89,8 @@ export default {
}
},
},
mounted() {
this.opened = this.boards.length > 0
},
}
</script>

View File

@@ -33,7 +33,8 @@ import Overview from './components/overview/Overview.vue'
Vue.use(Router)
export default new Router({
const router = new Router({
mode: 'history',
base: generateUrl('/apps/deck/'),
linkActiveClass: 'active',
routes: [
@@ -157,3 +158,15 @@ export default new Router({
},
],
})
router.beforeEach((to, from, next) => {
// Redirect if fullPath begins with a hash (ignore hashes later in path)
if (to.fullPath.substring(0, 2) === '/#') {
const path = to.fullPath.substring(2)
next(path)
return
}
next()
})
export default router

View File

@@ -66,7 +66,7 @@ export default new Vuex.Store({
sidebarShown: false,
currentBoard: null,
currentCard: null,
boards: [],
boards: loadState('deck', 'initialBoards', []),
sharees: [],
assignableUsers: [],
boardFilter: BOARD_FILTERS.ALL,