From 9aea7363cecf1d2631f3e2df01be35bb8cc66acf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=9C=E7=89=A9=E3=83=AA=E3=83=B3?= Date: Mon, 20 Oct 2025 16:11:01 +0900 Subject: [PATCH] =?UTF-8?q?fix(frontend):=20MkPoll=E3=81=AE=E9=9B=86?= =?UTF-8?q?=E8=A8=88=E5=AE=8C=E4=BA=86=E5=BE=8C=E3=81=AE=E6=8C=99=E5=8B=95?= =?UTF-8?q?=E3=81=8C=E3=81=8A=E3=81=8B=E3=81=97=E3=81=84=E3=81=AE=E3=82=92?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3=20(#16646)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * MkPollの集計完了後の挙動がおかしいのを修正 * fix lint * watchを削除できるように修正 * fix * Update Changelog * fix lint --------- Co-authored-by: kakkokari-gtyih <67428053+kakkokari-gtyih@users.noreply.github.com> --- CHANGELOG.md | 1 + packages/frontend/src/components/MkPoll.vue | 20 +++++++++++--------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e74b950467..8349bbc314 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ - ウォーターマークを回転させると歪む問題を修正 - ウォーターマークを敷き詰めると上下左右反転した画像/文字が表示される問題を修正 - ウォーターマークを回転させた際に画面からはみ出た部分を考慮できるように +- Fix: 投票が終了した後に投票結果が正しく表示されない問題を修正 ### Server - diff --git a/packages/frontend/src/components/MkPoll.vue b/packages/frontend/src/components/MkPoll.vue index 76c65397ae..9fc9c98493 100644 --- a/packages/frontend/src/components/MkPoll.vue +++ b/packages/frontend/src/components/MkPoll.vue @@ -57,15 +57,8 @@ const remaining = computed(() => { return Math.floor(Math.max(expiresAtTime.value - now.value, 0) / 1000); }); -const remainingWatchStop = watch(remaining, (to) => { - if (to <= 0) { - showResult.value = true; - remainingWatchStop(); - } -}, { immediate: true }); - const total = computed(() => sum(props.choices.map(x => x.votes))); -const closed = computed(() => remaining.value === 0); +const closed = computed(() => remaining.value <= 0); const isVoted = computed(() => !props.multiple && props.choices.some(c => c.isVoted)); const timer = computed(() => i18n.tsx._poll[ remaining.value >= 86400 ? 'remainingDays' : @@ -78,7 +71,16 @@ const timer = computed(() => i18n.tsx._poll[ d: Math.floor(remaining.value / 86400), })); -const showResult = ref(props.readOnly || isVoted.value); +const showResult = ref(props.readOnly || isVoted.value || closed.value); + +if (!closed.value) { + const closedWatchStop = watch(closed, (isNowClosed) => { + if (isNowClosed) { + showResult.value = true; + closedWatchStop(); + } + }); +} const pleaseLoginContext = computed(() => ({ type: 'lookup',