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:
pac7
2025-10-08 12:23:22 +00:00
parent 6f74fcaed7
commit 2fc78cbde5
4 changed files with 40 additions and 8 deletions

View File

@@ -318,9 +318,10 @@ function topologicalSort(items: any[]): any[] {
if (item.depends_on) {
const parent = items.find(i => i.id === item.depends_on);
if (parent) {
visit(parent);
if (!parent) {
throw new Error(`Missing dependency: item ${item.id} depends on ${item.depends_on} which is not in the submission`);
}
visit(parent);
}
visiting.delete(item.id);