fix(account): gate reviews and stale refreshes

This commit is contained in:
2026-05-19 08:16:57 +08:00
parent 341c740ced
commit a8a00d8165
6 changed files with 175 additions and 9 deletions
+13 -2
View File
@@ -152,8 +152,19 @@ const ratingText = computed(() => {
return `${summary.value.averageRating.toFixed(1)} / 5 (${summary.value.reviewCount})`;
});
const clearReviewState = () => {
loadGeneration.value += 1;
reviews.value = [];
summary.value = null;
loading.value = false;
error.value = "";
};
const loadReviews = async () => {
if (!props.appKey) return;
if (!props.loggedIn || !props.appKey) {
clearReviewState();
return;
}
const generation = loadGeneration.value + 1;
loadGeneration.value = generation;
const appKey = props.appKey;
@@ -202,5 +213,5 @@ const submit = async () => {
};
onMounted(loadReviews);
watch(() => props.appKey, loadReviews);
watch(() => [props.appKey, props.loggedIn], loadReviews);
</script>