chore: sync article content on tab visibility change

This commit is contained in:
iamsivin
2026-04-15 19:58:38 +05:30
parent 5264de24b0
commit bb9c4cedec
2 changed files with 24 additions and 6 deletions
@@ -1,5 +1,6 @@
<script setup>
import { ref, computed, onMounted } from 'vue';
import { ref, computed, onMounted, watch } from 'vue';
import { useDocumentVisibility } from '@vueuse/core';
import { useRoute, useRouter } from 'vue-router';
import { useI18n } from 'vue-i18n';
import { useAlert, useTrack } from 'dashboard/composables';
@@ -13,6 +14,7 @@ const route = useRoute();
const router = useRouter();
const store = useStore();
const { t } = useI18n();
const visibility = useDocumentVisibility();
const { articleSlug, portalSlug } = route.params;
@@ -98,6 +100,11 @@ const previewArticle = () => {
});
};
// Re-fetch article when user returns to this tab
watch(visibility, state => {
if (state === 'visible') fetchArticleDetails();
});
onMounted(fetchArticleDetails);
</script>