feat: Implement cross-tab authentication synchronization in AuthProvider
- Add BroadcastChannel API for real-time logout synchronization across tabs - Implement storage event listener as fallback for older browsers - When a user logs out in one tab, all other tabs immediately reflect the logout state - Update tests to verify storage event and BroadcastChannel behavior - Update Architecture.md to document cross-tab synchronization - Update Web-Development.md with authentication state management notes The provider now broadcasts logout messages to other tabs so they immediately reflect the logout state without requiring a page refresh or additional API calls. The implementation uses BroadcastChannel as the primary sync mechanism with storage events as a fallback for older browsers. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -1,36 +1,3 @@
|
||||
## [Backend] `re` module imported inside function body
|
||||
|
||||
**Where found**
|
||||
|
||||
- `backend/app/main.py:198-199` — `import re` inside `_get_error_code()`
|
||||
|
||||
**Why this is needed**
|
||||
|
||||
Importing inside a function is a code smell. Standard practice is to import modules at the top of the file.
|
||||
|
||||
**Goal**
|
||||
|
||||
Move `import re` to the module-level imports at the top of `main.py`.
|
||||
|
||||
**What to do**
|
||||
|
||||
1. Add `import re` to existing imports section at top of `backend/app/main.py`
|
||||
2. Remove `import re` line from inside `_get_error_code()`
|
||||
|
||||
**Possible traps and issues**
|
||||
|
||||
- None — straightforward refactoring with no behavioral change
|
||||
|
||||
**Docs changes needed**
|
||||
|
||||
- No documentation changes needed
|
||||
|
||||
**Doc references**
|
||||
|
||||
- `backend/app/main.py`
|
||||
|
||||
---
|
||||
|
||||
## [Frontend] AuthProvider sessionStorage not synchronized across tabs
|
||||
|
||||
**Where found**
|
||||
|
||||
Reference in New Issue
Block a user