diff --git a/apps/ai-game-creator-shell/src/features/project-workspace/LocalGamePreviewFrame.tsx b/apps/ai-game-creator-shell/src/features/project-workspace/LocalGamePreviewFrame.tsx index 880adb5c3..f47951e8f 100644 --- a/apps/ai-game-creator-shell/src/features/project-workspace/LocalGamePreviewFrame.tsx +++ b/apps/ai-game-creator-shell/src/features/project-workspace/LocalGamePreviewFrame.tsx @@ -272,6 +272,7 @@ export function LocalGamePreviewFrame({ title, className, inspectMode = false, + reloadNonce = 0, onInspectSelection, onInspectExit, }: { @@ -279,6 +280,14 @@ export function LocalGamePreviewFrame({ title: string; className?: string; inspectMode?: boolean; + /** + * 换一个值就把 iframe 重新挂载一次=重新载入运行页面(使用方的「刷新运行画面」)。 + * + * 游戏预览不是 vite dev 的实时刷新:改完代码要看到新一版只有重载页面这一条路。`src` 不变, + * 靠 React 的 `key` 换元素身份——跨域 iframe 里 `contentWindow.location.reload()` 会被 + * 浏览器挡掉(运行页面在另一个端口上)。 + */ + reloadNonce?: number; onInspectSelection?: (selection: LocalGamePreviewInspectSelection) => void; onInspectExit?: () => void; }) { @@ -425,6 +434,7 @@ export function LocalGamePreviewFrame({