mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-22 09:31:12 -05:00
Improve error handling and dependency checks for data processing
Address issues in FieldHistoryDialog by clearing changes on error, enhance useEntityVersions to provide default profiles for missing users, add localStorage availability check in useLocationAutoDetect, and improve dependency resolution logic in supabase/functions/process-selective-approval. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 334e80ad-8f74-4e3a-acec-6dd811858e98 Replit-Commit-Checkpoint-Type: intermediate_checkpoint
This commit is contained in:
@@ -65,10 +65,16 @@ export function useEntityVersions(entityType: string, entityId: string) {
|
||||
.select('user_id, username, avatar_url')
|
||||
.in('user_id', userIds);
|
||||
|
||||
const versionsWithProfiles = data?.map(v => ({
|
||||
...v,
|
||||
changer_profile: profiles?.find(p => p.user_id === v.changed_by)
|
||||
})) as EntityVersion[];
|
||||
const versionsWithProfiles = data?.map(v => {
|
||||
const profile = profiles?.find(p => p.user_id === v.changed_by);
|
||||
return {
|
||||
...v,
|
||||
changer_profile: profile || {
|
||||
username: 'Unknown',
|
||||
avatar_url: null
|
||||
}
|
||||
};
|
||||
}) as EntityVersion[];
|
||||
|
||||
// Only update state if component is still mounted
|
||||
if (isMountedRef.current) {
|
||||
|
||||
Reference in New Issue
Block a user