This commit is contained in:
2025-12-10 15:41:44 +01:00
parent fbbcf414a4
commit 6d61be9c51
22 changed files with 1721 additions and 1987 deletions

View File

@@ -16,5 +16,25 @@ export function useEffectiveDriverId(): string {
}
| undefined;
return user?.primaryDriverId ?? 'driver-1';
// In alpha mode, if the user has no bound driver yet, fall back to the
// first seeded driver from the in-memory repository instead of a hardcoded ID.
if (user?.primaryDriverId) {
return user.primaryDriverId;
}
try {
// Lazy-load to avoid importing DI facade at module evaluation time
const { getDriverRepository } = require('./di-container') as typeof import('./di-container');
const repo = getDriverRepository();
// In-memory repository is synchronous for findAll in the demo implementation
const allDrivers = repo.findAllSync?.() as Array<{ id: string }> | undefined;
if (allDrivers && allDrivers.length > 0) {
return allDrivers[0].id;
}
} catch {
// Ignore and fall back to legacy default below
}
// Legacy fallback: preserved only as a last resort for demo
return '';
}