Merge pull request #5281 from nextcloud/perf/initial-state
This commit is contained in:
@@ -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() {
|
||||
|
||||
@@ -89,5 +89,8 @@ export default {
|
||||
}
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.opened = this.boards.length > 0
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user