fix: show alert instead of redirecting to non-existent /client route

When profile guard fails (single-player profile detected):
- Show JavaScript alert explaining the issue
- Leave session cleanly via handleLeaveSession()
- Redirect to dashboard (/) instead of /client (404)

Alert message explains:
- Audio profile not suitable for multi-user sessions
- Need proper audio interface or create private session

TODO: Replace alert() with proper modal dialog component
that offers options like legacy app (create private session,
go to audio settings, cancel).

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Nuwan 2026-02-02 10:13:14 +05:30
parent 332ae61ba0
commit 010cf55302
1 changed files with 10 additions and 3 deletions

View File

@ -376,10 +376,17 @@ 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 doesn't control navigation, show alert (legacy behavior shows dialog)
if (!error?.controlled_location) {
logger.debug("Profile guard failed, redirecting to home");
history.push('/client');
logger.debug("Profile guard failed, showing alert");
// TODO: Replace with proper JKSessionProfileDialog component
alert(
'Your current audio profile is not suitable for multi-user sessions.\n\n' +
'Please configure a proper audio interface in your audio settings, ' +
'or create a private session for solo practice.'
);
await sessionModel.handleLeaveSession();
history.push('/'); // Redirect to dashboard
return; // Don't continue with session join
}
// If controlled_location is true, the error handler already redirected