From 5b799a125a970e5e56f29a08b3c86450855fb6c4 Mon Sep 17 00:00:00 2001 From: 苏向夜 Date: Sun, 29 Mar 2026 21:32:54 +0800 Subject: refactor(ui): rewrite instance create --- packages/ui/src/components/bottom-bar.tsx | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) (limited to 'packages/ui/src/components/bottom-bar.tsx') diff --git a/packages/ui/src/components/bottom-bar.tsx b/packages/ui/src/components/bottom-bar.tsx index fd4a681..f73ace4 100644 --- a/packages/ui/src/components/bottom-bar.tsx +++ b/packages/ui/src/components/bottom-bar.tsx @@ -1,5 +1,5 @@ import { Play, User, XIcon } from "lucide-react"; -import { useCallback, useEffect, useState } from "react"; +import { useCallback, useState } from "react"; import { toast } from "sonner"; import { cn } from "@/lib/utils"; import { useAuthStore } from "@/models/auth"; @@ -29,18 +29,8 @@ export function BottomBar() { stopGame, } = useGameStore(); - const [selectedVersion, setSelectedVersion] = useState(null); const [showLoginModal, setShowLoginModal] = useState(false); - useEffect(() => { - const nextVersion = activeInstance?.versionId ?? ""; - if (selectedVersion === nextVersion) { - return; - } - - setSelectedVersion(nextVersion); - }, [activeInstance?.versionId, selectedVersion]); - const handleInstanceChange = useCallback( async (instanceId: string) => { if (activeInstance?.id === instanceId) { @@ -70,10 +60,7 @@ export function BottomBar() { return; } - await startGame( - activeInstance.id, - selectedVersion || activeInstance.versionId, - ); + await startGame(activeInstance.id, activeInstance.versionId ?? ""); }; const handleStopGame = async () => { -- cgit v1.2.3-70-g09d2