perf: nettoyage code mort, sécurisation clé, et remplacement des prints
This commit is contained in:
@@ -66,7 +66,7 @@ class ContainerProvider with ChangeNotifier {
|
||||
// Charger toutes les pages en boucle
|
||||
while (hasMore) {
|
||||
pageCount++;
|
||||
print('[ContainerProvider] Loading page $pageCount...');
|
||||
DebugLog.info('[ContainerProvider] Loading page $pageCount...');
|
||||
|
||||
final result = await _dataService.getContainersPaginated(
|
||||
limit: 100, // Charger 100 par page pour aller plus vite
|
||||
@@ -86,14 +86,14 @@ class ContainerProvider with ChangeNotifier {
|
||||
hasMore = result['hasMore'] as bool? ?? false;
|
||||
lastVisible = result['lastVisible'] as String?;
|
||||
|
||||
print('[ContainerProvider] Loaded ${containers.length} containers, total: ${_containers.length}, hasMore: $hasMore');
|
||||
DebugLog.info('[ContainerProvider] Loaded ${containers.length} containers, total: ${_containers.length}, hasMore: $hasMore');
|
||||
}
|
||||
|
||||
_isLoading = false;
|
||||
_isInitialized = true;
|
||||
notifyListeners();
|
||||
} catch (e) {
|
||||
print('Error loading containers: $e');
|
||||
DebugLog.error('[ContainerProvider] Error loading containers', e);
|
||||
_isLoading = false;
|
||||
notifyListeners();
|
||||
}
|
||||
@@ -292,7 +292,7 @@ class ContainerProvider with ChangeNotifier {
|
||||
Future<List<ContainerModel>> getContainersByIds(List<String> containerIds) async {
|
||||
if (containerIds.isEmpty) return [];
|
||||
|
||||
print('[ContainerProvider] Loading ${containerIds.length} containers by IDs...');
|
||||
DebugLog.info('[ContainerProvider] Loading ${containerIds.length} containers by IDs...');
|
||||
|
||||
try {
|
||||
// Vérifier d'abord le cache local
|
||||
@@ -320,7 +320,7 @@ class ContainerProvider with ChangeNotifier {
|
||||
}
|
||||
}
|
||||
|
||||
print('[ContainerProvider] Found ${cachedContainers.length} in cache, ${missingIds.length} missing');
|
||||
DebugLog.info('[ContainerProvider] Found ${cachedContainers.length} in cache, ${missingIds.length} missing');
|
||||
|
||||
// Si tous sont en cache, retourner directement
|
||||
if (missingIds.isEmpty) {
|
||||
@@ -341,12 +341,12 @@ class ContainerProvider with ChangeNotifier {
|
||||
}
|
||||
}
|
||||
|
||||
print('[ContainerProvider] Loaded ${loadedContainers.length} containers from API');
|
||||
DebugLog.info('[ContainerProvider] Loaded ${loadedContainers.length} containers from API');
|
||||
|
||||
// Retourner tous les conteneurs (cache + chargés)
|
||||
return [...cachedContainers, ...loadedContainers];
|
||||
} catch (e) {
|
||||
print('[ContainerProvider] Error loading containers by IDs: $e');
|
||||
DebugLog.error('[ContainerProvider] Error loading containers by IDs', e);
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user