v1.3.5: Critical Swagger UI Loading Fix
π§ Critical Swagger UI Loading Fix - Enhanced Error Handling
Critical fix: Improved error handling for Swagger UI initialization timing issues.
π οΈ Bug Fixes
- π Enhanced Retry Logic - Fixed TypeError when window.ui is undefined during Swagger UI loading
- π Better Error Handling - Added try-catch around Swagger UI access with detailed logging
- β±οΈ Improved Timing - Increased retry attempts (20x) for slower Swagger UI initialization
- π Enhanced Debugging - More detailed console logs for troubleshooting UI loading issues
π§ Technical Improvements
- Error-Safe UI Checking:
try { if (window.ui && typeof window.ui.preauthorizeApiKey === 'function') { // Safe access with type checking } } catch (error) { console.log('π UI check error (will retry):', error.message); }
- Robust Retry Mechanism: 20 attempts over 10 seconds for UI readiness
- Graceful Degradation: Clear error messages when Swagger UI fails to load
π― What This Fixes
- TypeError Prevention: No more "Cannot read properties of undefined" errors
- Better Reliability: AUTO_AUTHORIZE works consistently across different loading speeds
- Enhanced Debugging: Clear console logs to diagnose Swagger UI loading issues
π Backward Compatibility
- 100% Compatible: All existing functionality preserved
- Zero Breaking Changes: Pure bug fix release
π¦ Installation
pip install --upgrade drf-spectacular-auth==1.3.5This specifically addresses the console error you encountered:
TypeError: Cannot read properties of undefined (reading 'preauthorizeApiKey')