Full codebase cleanup and optimization pass
- Fix all hardcoded light colors breaking dark mode (FileAttachment, TaskDetail, RequestDetail) - Parallelize sequential DB fetches in TaskDetail, CompanyDetail, MyProjects - Add error handling: NewRequest project/file upload, MyCompany update, CompanyDetail prices, AuthContext profile fetch - Fix currentUser.company_id → currentUser.company?.id in NewRequest - Remove stale company.email references from InvoiceDetail, ProjectDetail, TaskDetail - Clean up dead email field from Companies form reset Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -16,15 +16,19 @@ export function AuthProvider({ children }) {
|
||||
const [loading, setLoading] = useState(true);
|
||||
|
||||
const fetchAndCacheProfile = async (authUser) => {
|
||||
const { data } = await supabase
|
||||
.from('profiles')
|
||||
.select('*, company:companies(id, name, phone, address)')
|
||||
.eq('id', authUser.id)
|
||||
.single();
|
||||
if (data) {
|
||||
const profile = { ...data, email: authUser.email };
|
||||
setCurrentUser(profile);
|
||||
localStorage.setItem(PROFILE_CACHE_KEY, JSON.stringify(profile));
|
||||
try {
|
||||
const { data } = await supabase
|
||||
.from('profiles')
|
||||
.select('*, company:companies(id, name, phone, address)')
|
||||
.eq('id', authUser.id)
|
||||
.single();
|
||||
if (data) {
|
||||
const profile = { ...data, email: authUser.email };
|
||||
setCurrentUser(profile);
|
||||
localStorage.setItem(PROFILE_CACHE_KEY, JSON.stringify(profile));
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Profile fetch failed:', err);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user