diff --git a/jam-ui/src/components/client/JKSessionScreen.js b/jam-ui/src/components/client/JKSessionScreen.js index 02c1d2882..9654450fc 100644 --- a/jam-ui/src/components/client/JKSessionScreen.js +++ b/jam-ui/src/components/client/JKSessionScreen.js @@ -376,10 +376,13 @@ const JKSessionScreen = () => { } catch (error) { logger.error("User profile is not appropriate for session:", error); + // If error doesn't control navigation, redirect to home (legacy behavior) if (!error?.controlled_location) { - // Handle error without controlled_location - // Session leave will be triggered by outer catch block + logger.debug("Profile guard failed, redirecting to home"); + history.push('/client'); + return; // Don't continue with session join } + // If controlled_location is true, the error handler already redirected } } catch (error) { logger.error("Error: waiting for session page enter to complete:", error); diff --git a/jam-ui/src/hooks/useGearUtils.js b/jam-ui/src/hooks/useGearUtils.js index 6b25c7917..c9aa8cabc 100644 --- a/jam-ui/src/hooks/useGearUtils.js +++ b/jam-ui/src/hooks/useGearUtils.js @@ -486,8 +486,16 @@ const useGearUtils = () => { const canPlayResult = await canPlayWithOthers(); if (!canPlayResult.canPlay) { - const error = new Error('Cannot play with others - profile check failed'); + // TODO: Show dialog like legacy app with options: + // - Create private session (controlled_location: true, redirect to new session) + // - Go to audio settings (controlled_location: true, redirect to /account/audio) + // - Cancel (controlled_location: false, redirect to home) + + // For now, mimic legacy behavior: reject and let caller redirect to home + const error = new Error('Cannot play with others - single player profile detected'); error.canPlayResult = canPlayResult; + error.controlled_location = false; // Let caller handle redirect + error.reason = 'single_player_profile'; reject(error); } else { resolve();