diff --git a/apps/ai-game-creator-shell/src/view/home/PlatformGameForkSection.tsx b/apps/ai-game-creator-shell/src/view/home/PlatformGameForkSection.tsx index 8dfa54bf1..aad318466 100644 --- a/apps/ai-game-creator-shell/src/view/home/PlatformGameForkSection.tsx +++ b/apps/ai-game-creator-shell/src/view/home/PlatformGameForkSection.tsx @@ -10,11 +10,11 @@ * 渲染层只做输入解析、加载态与失败分类。 */ -import { useRef, useState } from 'react'; import type { FormEvent } from 'react'; +import { useRef, useState } from 'react'; -import type { InitLocalProjectResult } from '../../app/types'; import { resolveTauriInvoke } from '../../app/tauri'; +import type { InitLocalProjectResult } from '../../app/types'; import { classifyPlatformForkFailure, parsePlatformGameId, diff --git a/apps/ai-game-creator-shell/src/view/home/index.tsx b/apps/ai-game-creator-shell/src/view/home/index.tsx index e41681053..da902be9b 100644 --- a/apps/ai-game-creator-shell/src/view/home/index.tsx +++ b/apps/ai-game-creator-shell/src/view/home/index.tsx @@ -20,13 +20,13 @@ import { resolveHomeCreationFailureMessage } from '../../features/app-shell/home import { ConversationModelSelect } from '../../features/project-workspace/ConversationModelSelect'; import type { GameTemplateEntry } from '../../features/template-library/templateLibraryModel'; import type { ProjectOpenAnalytics } from '../../services/clientAnalytics'; -import PlatformGameForkSection from './PlatformGameForkSection'; import RichInputArea, { UploadButton } from './components/RichInputArea'; import { richTextToAttachments, richTextToPrompt, } from './components/RichInputArea/richTextToPrompt'; import { resolveHomeStartMode } from './homeStartMode'; +import PlatformGameForkSection from './PlatformGameForkSection'; import TemplateRecommendations from './TemplateRecommendations'; import { type HomeCreationType, diff --git a/server-rs/crates/pingora-gateway/src/main.rs b/server-rs/crates/pingora-gateway/src/main.rs index 51df31e98..3d3cffc11 100644 --- a/server-rs/crates/pingora-gateway/src/main.rs +++ b/server-rs/crates/pingora-gateway/src/main.rs @@ -69,6 +69,7 @@ const MAIN_SPA_PATHS: &[&str] = &[ "/editor/canvas", "/games", "/games/detail", + "/games/lineage", "/games/mine", "/games/play", "/games/publish", diff --git a/src/components/game-distribution/GameDetailPage.tsx b/src/components/game-distribution/GameDetailPage.tsx index 907dec1ef..a250f69d0 100644 --- a/src/components/game-distribution/GameDetailPage.tsx +++ b/src/components/game-distribution/GameDetailPage.tsx @@ -6,6 +6,7 @@ import { } from '@genarrative/shared/components'; import { ArrowLeft, Gamepad2, Maximize2 } from 'lucide-react'; import { useCallback, useEffect, useRef, useState } from 'react'; + import { GAME_DISTRIBUTION_FORK_AUTHORIZATION_LABELS, type GameDistributionRecoveryAction, diff --git a/src/components/game-distribution/GameLineagePage.tsx b/src/components/game-distribution/GameLineagePage.tsx index ee23259bb..b2af5a662 100644 --- a/src/components/game-distribution/GameLineagePage.tsx +++ b/src/components/game-distribution/GameLineagePage.tsx @@ -143,7 +143,10 @@ export function GameLineagePage({ void loadLineage(); }, [loadLineage]); - const nodes = lineage?.nodes ?? []; + // `lineage?.nodes ?? []` 在缺省分支每次渲染都会产生新数组,直接喂给下面的 useMemo 会让依赖 + // 每次渲染都变;这里把派生结果本身稳定下来:值仍是同一表达式的结果,identity 只在 `lineage` + // 变化时改变,因此两个下游 useMemo 的取值不变、只少做无谓重算。 + const nodes = useMemo(() => lineage?.nodes ?? [], [lineage]); const groups = useMemo(() => groupNodesByGeneration(nodes), [nodes]); const visibleIds = useMemo( () => new Set(nodes.map((node) => node.gameId)), diff --git a/src/components/game-distribution/MyGamesPage.test.tsx b/src/components/game-distribution/MyGamesPage.test.tsx index e935820bb..93e23939a 100644 --- a/src/components/game-distribution/MyGamesPage.test.tsx +++ b/src/components/game-distribution/MyGamesPage.test.tsx @@ -8,15 +8,15 @@ import { beforeEach, expect, test, vi } from 'vitest'; import { cancelGameVersion, deleteMyGame, - getDerivedGames, type GameDistributionMyGame, + getDerivedGames, getGameVersion, listMyGames, loadVersionRecoveryActions, submitGameVersion, unpublishGame, - updateMyGame, updateGameForkAuthorization, + updateMyGame, } from '../../services/gameDistributionClient'; import { AuthUiContext } from '../auth/AuthUiContext'; import { MyGamesPage } from './MyGamesPage'; diff --git a/src/components/game-distribution/MyGamesPage.tsx b/src/components/game-distribution/MyGamesPage.tsx index c64ba2dac..456c5fc51 100644 --- a/src/components/game-distribution/MyGamesPage.tsx +++ b/src/components/game-distribution/MyGamesPage.tsx @@ -6,20 +6,20 @@ import { useCallback, useEffect, useMemo, useState } from 'react'; import type { GameDistributionRecoveryAction } from '../../../packages/shared/src/contracts/gameDistribution'; import { canUpgradeGameForkAuthorization, - GAME_DISTRIBUTION_FORK_AUTHORIZATIONS, GAME_DISTRIBUTION_FORK_AUTHORIZATION_LABELS, GAME_DISTRIBUTION_FORK_AUTHORIZATION_SHORT_LABELS, + GAME_DISTRIBUTION_FORK_AUTHORIZATIONS, type GameDistributionForkAuthorization, resolveGameForkAuthorization, } from '../../../packages/shared/src/contracts/gameDistribution'; import { cancelGameVersion, deleteMyGame, - getDerivedGames, type GameDistributionLineageNode, type GameDistributionMyGame, type GameDistributionUpdateMyGameResponse, type GameDistributionVersionStatusEntry, + getDerivedGames, listMyGames, loadVersionRecoveryActions, submitGameVersion, diff --git a/src/services/gameDistributionClient.ts b/src/services/gameDistributionClient.ts index 2f3dd84ab..fffe2ba85 100644 --- a/src/services/gameDistributionClient.ts +++ b/src/services/gameDistributionClient.ts @@ -14,8 +14,8 @@ import type { GameDistributionReviewsResponse, GameDistributionSaveReviewRequest, GameDistributionSaveReviewResponse, - GameDistributionUpdateGameMetadataRequest, GameDistributionSetForkAuthorizationRequest, + GameDistributionUpdateGameMetadataRequest, GameDistributionVersionDetail, GameDistributionVersionStatus as GameDistributionVersionStatusValue, GameDistributionVersionSummary,