This commit is contained in:
eric
2026-03-16 20:24:28 -05:00
parent c93eb7b2ee
commit 473fa1a1cf
3 changed files with 27 additions and 8 deletions

View File

@@ -52,7 +52,7 @@ export default function MyRegistrationStatus() {
return;
}
setLoading(true);
fetch(`/api/join/by-wechat?wechat_id=${encodeURIComponent(wechatId)}`)
fetch(`/api/join/by-wechat?wechat_id=${encodeURIComponent(wechatId)}&_=${Date.now()}`, { cache: "no-store" })
.then((r) => r.json())
.then((d) => {
if (d?.hasRecord) {
@@ -83,10 +83,20 @@ export default function MyRegistrationStatus() {
const onUpdate = () => {
if (!cancelled) fetchStatus();
};
const onVisibilityChange = () => {
if (document.visibilityState === "visible" && !cancelled) fetchStatus();
};
const onPageShow = (e: PageTransitionEvent) => {
if (e.persisted && !cancelled) fetchStatus();
};
window.addEventListener("vip:updated", onUpdate);
document.addEventListener("visibilitychange", onVisibilityChange);
window.addEventListener("pageshow", onPageShow);
return () => {
cancelled = true;
window.removeEventListener("vip:updated", onUpdate);
document.removeEventListener("visibilitychange", onVisibilityChange);
window.removeEventListener("pageshow", onPageShow);
};
}, []);