update 9/20/25
This commit is contained in:
@@ -26,7 +26,7 @@ interface OrgContextType {
|
||||
user?: User;
|
||||
orgId: string;
|
||||
employees: Employee[];
|
||||
submissions: Record<string, Submission>;
|
||||
submissions: Submission[];
|
||||
reports: Record<string, EmployeeReport>;
|
||||
loading: boolean;
|
||||
upsertOrg: (data: Partial<OrgData>) => Promise<void>;
|
||||
@@ -58,11 +58,11 @@ export const OrgProvider: React.FC<{ children: React.ReactNode; selectedOrgId: s
|
||||
const { user } = useAuth();
|
||||
const [org, setOrg] = useState<OrgData | null>(null);
|
||||
const [employees, setEmployees] = useState<Employee[]>([]);
|
||||
const [submissions, setSubmissions] = useState<Record<string, Submission>>({});
|
||||
const [submissions, setSubmissions] = useState<Submission[]>([]);
|
||||
const [reports, setReports] = useState<Record<string, EmployeeReport>>({});
|
||||
const [, setReportVersions] = useState<Record<string, Array<{ id: string; createdAt: number; report: EmployeeReport }>>>({});
|
||||
const [, setCompanyReports] = useState<Array<{ id: string; createdAt: number; summary: string }>>([]);
|
||||
const [, setFullCompanyReports] = useState<CompanyReport[]>([]);
|
||||
const [reportVersions, setReportVersions] = useState<Record<string, Array<{ id: string; createdAt: number; report: EmployeeReport }>>>({});
|
||||
const [companyReports, setCompanyReports] = useState<Array<{ id: string; createdAt: number; summary: string }>>([]);
|
||||
const [fullCompanyReports, setFullCompanyReports] = useState<CompanyReport[]>([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
|
||||
// Use the provided selectedOrgId instead of deriving from user
|
||||
@@ -85,7 +85,7 @@ export const OrgProvider: React.FC<{ children: React.ReactNode; selectedOrgId: s
|
||||
const [orgData, employeesData, submissionsData, reportsData, companyReportsData] = await Promise.allSettled([
|
||||
secureApi.getOrgData().catch(() => null),
|
||||
secureApi.getEmployees().catch(() => []),
|
||||
secureApi.getSubmissions().catch(() => ({})),
|
||||
secureApi.getSubmissions().catch(() => ([])),
|
||||
secureApi.getReports().catch(() => ({})),
|
||||
secureApi.getCompanyReports().catch(() => [])
|
||||
]);
|
||||
@@ -116,7 +116,7 @@ export const OrgProvider: React.FC<{ children: React.ReactNode; selectedOrgId: s
|
||||
setSubmissions(submissionsData.value);
|
||||
} else {
|
||||
console.warn('Could not load submissions');
|
||||
setSubmissions({});
|
||||
setSubmissions([]);
|
||||
}
|
||||
|
||||
// Process reports data
|
||||
@@ -291,7 +291,7 @@ export const OrgProvider: React.FC<{ children: React.ReactNode; selectedOrgId: s
|
||||
const seedInitialData = async () => {
|
||||
// Start with clean slate - let users invite their own employees and generate real data
|
||||
setEmployees([]);
|
||||
setSubmissions({});
|
||||
setSubmissions([]);
|
||||
setReports({});
|
||||
setFullCompanyReports([]);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user