Skip to content

Commit

Permalink
Drop entity detail cache (#192)
Browse files Browse the repository at this point in the history
* bind key to router view in order to drop cache for certain pages
* remove get entities call from entity list component on activated, since it causes unnecessary queries
* clear modal-backdrop from modal when deactivated
* exclude route components from keep-alive
* move activated from entity list where it was before
* remove keep-alive from root component

closes #191
  • Loading branch information
TeodoraPavlova authored Feb 2, 2024
1 parent dee66fe commit 7729d14
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 14 deletions.
4 changes: 1 addition & 3 deletions frontend/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@
<AlertDisplay/>
<div class="container mt-2">
<router-view v-slot="{Component}">
<keep-alive>
<component :is="Component"/>
</keep-alive>
<component :is="Component"/>
</router-view>
</div>

Expand Down
7 changes: 4 additions & 3 deletions frontend/src/components/Entity.vue
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,10 @@ export default {
if (newValue?.name) {
document.title = newValue.name;
}
},
async "$route.params.entitySlug"() {
await this.updateEntity();
},
$route: {
handler: "updateEntity",
immediate: true
},
}
};
Expand Down
8 changes: 7 additions & 1 deletion frontend/src/components/inputs/ReferencedEntitySelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ export default {
text: "Apply",
callback: this.onSelect
})
]
],
currentEntitySlug: this.$route.params.entitySlug,
}
},
activated() {
Expand All @@ -78,6 +79,11 @@ export default {
if (!this.modelValue) {
return;
}
if (this.currentEntitySlug !== this.$route.params.entitySlug) {
this.selected.length = 0;
this.currentEntitySlug = this.$route.params.entitySlug;
}
const preselectedIds = this.selected.map(x => x.id);
let toQuery = this.modelValue;
if (!Array.isArray(this.modelValue)) {
Expand Down
14 changes: 7 additions & 7 deletions frontend/src/router.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createRouter, createWebHistory } from 'vue-router'
import {createRouter, createWebHistory} from 'vue-router'
import SchemaCreate from "@/components/SchemaCreate.vue"
import Changes from "@/components/change_review/Changes";
import Entity from "@/components/Entity.vue"
Expand Down Expand Up @@ -44,12 +44,12 @@ export const router = createRouter({
}
},
{
path: '/review',
component: Changes,
name: 'review-list',
meta: {
title: 'Pending Reviews'
}
path: '/review',
component: Changes,
name: 'review-list',
meta: {
title: 'Pending Reviews'
}
},
{
path: '/user-management',
Expand Down

0 comments on commit 7729d14

Please sign in to comment.