diff --git a/frontend/middleware/setCurrentProject.ts b/frontend/middleware/setCurrentProject.ts index b015050f..b32975cc 100644 --- a/frontend/middleware/setCurrentProject.ts +++ b/frontend/middleware/setCurrentProject.ts @@ -1,13 +1,13 @@ import { NuxtAppOptions } from '@nuxt/types' +import _ from 'lodash' -export default async ({ app, route, redirect }: NuxtAppOptions) => { +export default _.debounce(async ({ app, route, redirect }: NuxtAppOptions) => { const project = app.store.getters['projects/currentProject'] - const isNotSet = Object.keys(project).length === 0 && project.constructor === Object - if (isNotSet || project.id !== route.params.id) { + if (project.id !== route.params.id) { try { await app.store.dispatch('projects/setCurrentProject', route.params.id) } catch (e) { redirect('/projects') } } -} +}, 1000) diff --git a/frontend/pages/projects/_id/comments/index.vue b/frontend/pages/projects/_id/comments/index.vue index 89225e6e..2acd2d47 100644 --- a/frontend/pages/projects/_id/comments/index.vue +++ b/frontend/pages/projects/_id/comments/index.vue @@ -26,12 +26,12 @@