Now let me check the game-canvas component to understand how it handles restarts:
I can see the issue! When the user clicks "Restart" in the game-over modal, it calls handleStartGame, which sets the game to "playing" but doesn't properly reset the game engine. The GameCanvas component still has the old game-over modal visible because gameOverData isn't being cleared, and the engine isn't being reset. The issue is that the game state is stuck between views.
Let me fix this by:
I've fixed the restart issue by adding a restartKey to the game state that increments whenever the player starts or restarts a game. This key is used as a React key prop on the GameCanvas component, forcing it to completely unmount and remount with fresh state. I also ensured that gameOverData and levelCompleteData are cleared before starting a new game, preventing the stuck modal state. Now when you click retry or play again, the game will properly reset and start fresh without requiring you to go back to the menu first.
I see the issue - the Farcaster SDK is checking origins and there's a mismatch between https://v0.app and the preview URL. This is happening because the Farcaster provider is trying to initialize the SDK in a non-Farcaster environment. Let me check the Farcaster provider implementation:
I can see the issue. The Farcaster SDK is being loaded unconditionally and it's checking for frame origins, which is causing the error in the v0 preview environment. The SDK needs to be loaded more carefully with proper environment checks. Let me fix this by adding better detection logic and only initializing the SDK when truly inside a Farcaster frame:
I've fixed the origin mismatch error by adding intelligent Farcaster frame detection that checks if the app is actually running inside a Farcaster iframe before attempting to initialize the SDK. The provider now only loads the Farcaster SDK when it detects Farcaster-specific conditions (iframe context, referrer origins, or query parameters), preventing the origin validation errors in normal browser environments like the v0 preview.