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:
Krao Hasanee
2026-03-27 14:46:08 -04:00
parent 195c828f8b
commit 8034f15fb5
11 changed files with 61 additions and 57 deletions
+13 -9
View File
@@ -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);
}
};