From da191dd7a2c0d9746de54a69abf8338ba16a3c12 Mon Sep 17 00:00:00 2001 From: Zonghao Yuan <64521992+zonghaoyuan@users.noreply.github.com> Date: Sun, 14 Jun 2026 23:26:52 +0800 Subject: [PATCH] fix(play): render AuthModal in immersive branch (#78) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 手机竖屏 (orientation === 'portrait') 和桌面按 F 全屏 (presentation) 都会走 PlayInner 的 immersive 渲染分支,但该分支 加入时只带了 SettingsModal、漏掉了 AuthModal。导致这两条路径下 若 API 返回 401 触发 setAuthModalOpen(true),登录框不会被挂载, 用户无法登录继续游戏。 预设故事卡片入口 (onCardClick) 不做跳转前登录校验,未登录用户进 /play 后点选项即触发 401,在手机上复现该 bug。 补上与非 immersive 分支完全一致的 AuthModal 块,复用现有 authResolveRef 重试机制,登录成功后自动重放被拦截的请求。 --- app/play/page.tsx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/app/play/page.tsx b/app/play/page.tsx index 860924b..06ef63c 100644 --- a/app/play/page.tsx +++ b/app/play/page.tsx @@ -2253,6 +2253,21 @@ function PlayInner() { footerNote="保存后配音 Key 会立即生效,用你自己的额度合成当前这一幕的配音。" /> )} + {authModalOpen && ( + { + setAuthModalOpen(false); + // User dismissed login — drop the retry, don't re-run the action. + authResolveRef.current = null; + }} + onSuccess={() => { + setAuthModalOpen(false); + const retry = authResolveRef.current; + authResolveRef.current = null; + retry?.(); + }} + /> + )} ); }