mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-14 18:59:18 +02:00
Update weather data to show accurate local conditions
Ensure weather data is refreshed when location changes by invalidating and refetching queries on the client, and clearing the weather cache on the server. Replit-Commit-Author: Agent Replit-Commit-Session-Id: d43bd811-9372-45a7-8ac9-4a954c0538e1 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/d43bd811-9372-45a7-8ac9-4a954c0538e1/zoZabWF
This commit is contained in:
1 parent
5133f52d2a
commit
663f50d534
3 files changed
+16
-1
No files matched your search
@@ -154,8 +154,9 @@ export default function WeatherWidget() {
|
||||
description: data.message,
|
||||
});
|
||||
|
||||
// Actualiser les données météo
|
||||
// Forcer le rechargement immédiat des données météo
|
||||
queryClient.invalidateQueries({ queryKey: ['/api/weather/current'] });
|
||||
queryClient.refetchQueries({ queryKey: ['/api/weather/current'] });
|
||||
},
|
||||
onError: (error: any) => {
|
||||
toast({
|
||||
|
||||
@@ -2970,6 +2970,9 @@ RÉSUMÉ DU SCAN
|
||||
location: locationData.fullLocation
|
||||
});
|
||||
|
||||
// Vider le cache météo car la localisation a changé
|
||||
await storage.clearWeatherCache();
|
||||
|
||||
console.log('🌍 Localisation mise à jour automatiquement:', {
|
||||
from: settings.location,
|
||||
to: locationData.fullLocation,
|
||||
|
||||
@@ -202,6 +202,7 @@ export interface IStorage {
|
||||
createWeatherData(data: InsertWeatherData): Promise<WeatherData>;
|
||||
updateWeatherData(id: number, data: Partial<InsertWeatherData>): Promise<WeatherData>;
|
||||
deleteOldWeatherData(daysToKeep: number): Promise<void>;
|
||||
clearWeatherCache(): Promise<void>;
|
||||
}
|
||||
|
||||
export class DatabaseStorage implements IStorage {
|
||||
@@ -1840,6 +1841,11 @@ export class DatabaseStorage implements IStorage {
|
||||
|
||||
console.log(`🧹 Deleted weather data older than ${daysToKeep} days`);
|
||||
}
|
||||
|
||||
async clearWeatherCache(): Promise<void> {
|
||||
await db.delete(weatherData);
|
||||
console.log('🧹 Weather cache cleared due to location change');
|
||||
}
|
||||
}
|
||||
|
||||
// MemStorage class for development
|
||||
@@ -3261,6 +3267,11 @@ export class MemStorage implements IStorage {
|
||||
// In development, this is a no-op
|
||||
console.log(`🧹 DEV: Would delete weather data older than ${daysToKeep} days`);
|
||||
}
|
||||
|
||||
async clearWeatherCache(): Promise<void> {
|
||||
// In development, this is a no-op
|
||||
console.log('🧹 DEV: Weather cache cleared due to location change');
|
||||
}
|
||||
}
|
||||
|
||||
// Use MemStorage in development, DatabaseStorage in production
|
||||
|
||||
Reference in new issue
Block a user