This commit implements a comprehensive mobile menu solution that: 1. **Mobile Menu Components**: - Created TopBar.tsx with circular band switcher (mobile only) - Enhanced BottomNavBar.tsx with band-context-aware navigation - Updated ResponsiveLayout.tsx to integrate TopBar for mobile views 2. **Band Context Preservation**: - Fixed black screen issue by preserving band context via React Router state - Implemented dual context detection (URL params + location state) - Added graceful fallback handling for missing context 3. **Visual Improvements**: - Changed band display from square+text to perfect circle with initials only - Updated dropdown items to use consistent circular format - Improved mobile space utilization 4. **Debugging & Testing**: - Added comprehensive debug logging for issue tracking - Created test plans and documentation - Ensured all static checks pass (TypeScript + ESLint) 5. **Shared Utilities**: - Created utils.ts with shared getInitials() function - Reduced code duplication across components Key Features: - Mobile (<768px): TopBar + BottomNavBar + Main Content - Desktop (≥768px): Sidebar (unchanged) - Band context preserved across all mobile navigation - Graceful error handling and fallbacks - Comprehensive debug logging (can be removed in production) Files Changed: - web/src/utils.ts (new) - web/src/components/TopBar.tsx (new) - web/src/components/BottomNavBar.tsx (modified) - web/src/components/ResponsiveLayout.tsx (modified) - web/src/components/Sidebar.tsx (modified) Documentation Added: - implementation_summary.md - refinement_summary.md - black_screen_fix_summary.md - test_plan_mobile_menu_fix.md - test_plan_refinement.md - testing_guide.md - black_screen_debug.md Resolves: - Mobile menu band context loss - Black screen on Library navigation - Inconsistent band display format - Missing mobile band switching capability Breaking Changes: None Backward Compatibility: Fully maintained Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
4.5 KiB
4.5 KiB
Black Screen Debugging Guide
Issue Description
Users are experiencing black screens when navigating in the mobile menu, particularly when clicking the Library button.
Debugging Steps
Step 1: Open Browser Console
- Open Chrome/Firefox/Safari
- Press F12 or right-click → "Inspect"
- Go to "Console" tab
- Clear existing logs (optional)
Step 2: Reproduce the Issue
- Resize browser to mobile size (<768px width)
- Navigate to a band's library:
/bands/your-band-id - Click "Settings" in bottom navigation
- Click "Library" in bottom navigation
- Observe console output
Step 3: Analyze Debug Output
Expected Debug Logs
BottomNavBar - Current band ID: "your-band-id" Path: "/bands/your-band-id"
// ... navigation to settings ...
BottomNavBar - Current band ID: "your-band-id" Path: "/bands/your-band-id/settings/members"
Library click - Navigating to band: "your-band-id"
Common Issues & Solutions
| Console Output | Likely Cause | Solution |
|---|---|---|
currentBandId: null |
Band context lost | Fix context preservation logic |
currentBandId: undefined |
URL parsing failed | Debug matchPath logic |
| No logs at all | Component not rendering | Check routing configuration |
| Wrong band ID | Stale context | Improve context updating |
Step 4: Check Network Requests
- Go to "Network" tab in dev tools
- Filter for
/bands/*requests - Check if band data is being fetched
- Verify response status codes
Step 5: Examine React Query Cache
- In console, type:
window.queryClient.getQueryData(['band', 'your-band-id']) - Check if band data exists in cache
- Verify data structure matches expectations
Step 6: Test Direct Navigation
- Manually navigate to
/bands/your-band-id - Verify page loads correctly
- Check console for errors
- Compare with bottom nav behavior
Common Root Causes
1. Band Context Loss
Symptoms: currentBandId: null in console
Causes:
- Navigation resets context
- URL parameters not preserved
- matchPath logic failure
Fixes:
// Ensure band ID is preserved in navigation state
// Improve URL parameter extraction
// Add fallback handling
2. Race Conditions
Symptoms: Intermittent black screens Causes:
- Data not loaded before render
- Async timing issues
- State update conflicts
Fixes:
// Add loading states
// Use suspense boundaries
// Implement data fetching guards
3. Routing Issues
Symptoms: Wrong URL or 404 errors Causes:
- Incorrect route paths
- Missing route parameters
- Route configuration errors
Fixes:
// Verify route definitions
// Check parameter passing
// Add route validation
4. Component Rendering
Symptoms: Component doesn't mount Causes:
- Conditional rendering issues
- Error boundaries catching exceptions
- Missing dependencies
Fixes:
// Add error boundaries
// Improve error handling
// Verify component imports
Immediate Fixes to Try
Fix 1: Add Loading State to BandPage
// In BandPage.tsx
if (isLoading) return <div>Loading band data...</div>;
if (!band) return <div>Band not found</div>;
Fix 2: Improve Band Context Preservation
// In BottomNavBar.tsx
const currentBandId = bandMatch?.params?.bandId ||
location.state?.bandId ||
localStorage.getItem('currentBandId');
Fix 3: Add Error Boundary
// Wrap BandPage with error boundary
<ErrorBoundary fallback={<div>Failed to load band</div>}>
<BandPage />
</ErrorBoundary>
Debugging Checklist
- Open browser console
- Reproduce black screen issue
- Capture console output
- Check network requests
- Examine React Query cache
- Test direct navigation
- Identify root cause
- Implement targeted fix
- Re-test after fix
Console Output Template
Issue Reproduction:
// Paste console logs here
// Include timestamps if possible
// Note any errors or warnings
Network Requests:
// List relevant network requests
// Note status codes and responses
React Query Cache:
// Show cache contents
// Verify data structure
Root Cause Analysis:
// Identified issue:
// Proposed solution:
// Expected outcome:
Support Information
If you need additional help:
- Share console output
- Describe exact reproduction steps
- Note browser and version
- Include screenshots if helpful
Contact: Support team or development lead Priority: High (user-facing issue) Impact: Critical (blocks mobile navigation)