Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/components/abilities/AbilitySelection.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup>
import { ref, reactive, computed, inject, onMounted } from 'vue';
import { ref, reactive, computed, inject, onMounted, watch } from 'vue';
import { storeToRefs } from "pinia";

import { useAbilityStore } from "@/stores/abilityStore";
Expand Down Expand Up @@ -43,6 +43,15 @@ onMounted(async () => {
await abilityStore.getAbilities($api);
});

// Re-fetch abilities every time the modal is opened so newly created
// abilities (e.g. from another tab or the Abilities view) appear
// immediately without requiring a page reload.
watch(() => props.active, async (isActive) => {
if (isActive) {
await abilityStore.getAbilities($api);
}
});
Comment on lines +49 to +53

function clearFilters() {
filters.searchQuery = "";
filters.tactic = "";
Expand Down
19 changes: 18 additions & 1 deletion src/views/AdversariesView.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup>
import { inject, reactive, ref, onMounted, computed } from "vue";
import { inject, reactive, ref, onMounted, onActivated, computed, watch } from "vue";
import { storeToRefs } from "pinia";

import { useAdversaryStore } from "@/stores/adversaryStore";
Expand Down Expand Up @@ -31,6 +31,23 @@ onMounted(async () => {
await objectiveStore.getObjectives($api);
});

// When the view is re-activated via KeepAlive (e.g. switching tabs),
// refresh all data so new abilities and adversaries appear immediately.
onActivated(async () => {
await abilityStore.getAbilities($api);
await adversaryStore.getAdversaries($api);
await objectiveStore.getObjectives($api);
});
Comment on lines +36 to +40

// Refresh the adversary list when the dropdown opens so that adversaries
// created or modified on disk (by plugins, imports, etc.) are visible
// without leaving and returning to the page.
watch(isAdversaryDropdownOpen, async (isOpen) => {
if (isOpen) {
await adversaryStore.getAdversaries($api);
}
});
Comment on lines +45 to +49

function selectAdversary(adversary) {
selectedAdversary.value = adversary;
adversaryStore.updateSelectedAdversaryAbilities();
Expand Down
Loading