The Firestore listener leak nobody talks about
onSnapshot + client-side routing = zombie subscriptions
onSnapshot is easy to add and easy to forget. In a SPA, forgetting means memory leaks and phantom writes.
Why it happens
You subscribe in useEffect, forget to return the unsubscribe, or return it but rely on component unmount that never fires during a tab-hide. In an SPA with 20+ realtime pages, that compounds fast.
A discipline that scales
Register every subscription against a route-scoped cleanup registry. When the route changes, drain the registry. When the tab hides for more than N seconds, pause listeners and resume on focus. Your Firestore bill will thank you.
RAG that actually works in production
Vector search is the easy part. The hard part is chunking, freshness, and knowing when the model should refuse to answer.
Silent JWT refresh without the thundering herd
The 401 handler you copy-paste from Stack Overflow will fire N parallel refresh calls the moment your access token expires. Here's the fix.