mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-11 17:27:31 +02:00
Improve debugging for task verification status and data caching
Add extensive console logging to the Avoirs page to aid in debugging the verification process and data caching logic, including checks for `nocodbVerified` and detailed cache loading steps. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 9fcf4b21-eb0c-4e53-a567-e2ce4a6ad869 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/9fcf4b21-eb0c-4e53-a567-e2ce4a6ad869/uMhb9Na
This commit is contained in:
1 parent
62ada8e9cc
commit
c55044f89e
2 files changed
+32
-2
No files matched your search
Binary file not shown.
|
After Width: | Height: | Size: 190 KiB |
@@ -160,6 +160,17 @@ export default function Avoirs() {
|
||||
}
|
||||
const data = await response.json();
|
||||
console.log('💰 Avoirs received:', Array.isArray(data) ? data.length : 'NOT_ARRAY', 'items');
|
||||
|
||||
// 🔍 Debug: Vérifier les champs nocodbVerified
|
||||
if (Array.isArray(data) && data.length > 0) {
|
||||
console.log('🔍 Premiers avoirs avec nocodbVerified:', data.map(a => ({
|
||||
id: a.id,
|
||||
invoiceReference: a.invoiceReference,
|
||||
nocodbVerified: a.nocodbVerified,
|
||||
nocodbVerifiedAt: a.nocodbVerifiedAt
|
||||
})));
|
||||
}
|
||||
|
||||
return Array.isArray(data) ? data : [];
|
||||
},
|
||||
enabled: !!user,
|
||||
@@ -168,19 +179,38 @@ export default function Avoirs() {
|
||||
// 🔄 Charger les vérifications du cache au démarrage
|
||||
useEffect(() => {
|
||||
const loadCachedVerifications = async () => {
|
||||
console.log('🔍 LoadCache - Début vérification:', {
|
||||
hasAvoirs: !!avoirs,
|
||||
avoirCount: avoirs?.length || 0
|
||||
});
|
||||
|
||||
if (!avoirs || avoirs.length === 0) return;
|
||||
|
||||
const cachedResults: Record<number, any> = {};
|
||||
for (const avoir of avoirs) {
|
||||
console.log('🔍 LoadCache - Avoir analysé:', {
|
||||
id: avoir.id,
|
||||
hasInvoiceRef: !!avoir.invoiceReference?.trim(),
|
||||
invoiceReference: avoir.invoiceReference,
|
||||
nocodbVerified: avoir.nocodbVerified,
|
||||
shouldCache: !!(avoir.invoiceReference?.trim() && avoir.nocodbVerified)
|
||||
});
|
||||
|
||||
if (avoir.invoiceReference?.trim() && avoir.nocodbVerified) {
|
||||
// Si l'avoir est validé, marquer comme vérifié
|
||||
cachedResults[avoir.id] = { exists: true, fromCache: true, permanent: true };
|
||||
console.log('✅ LoadCache - Avoir ajouté au cache:', avoir.id);
|
||||
}
|
||||
}
|
||||
|
||||
console.log('🔍 LoadCache - Résultats finaux:', {
|
||||
cachedCount: Object.keys(cachedResults).length,
|
||||
cachedResults
|
||||
});
|
||||
|
||||
if (Object.keys(cachedResults).length > 0) {
|
||||
setAvoirVerificationResults(prev => ({ ...prev, ...cachedResults }));
|
||||
console.log('✅ Vérifications cachées chargées:', cachedResults);
|
||||
console.log('✅ Vérifications cachées chargées et appliquées:', cachedResults);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1135,7 +1165,7 @@ export default function Avoirs() {
|
||||
{verifyingAvoirs.has(avoir.id) ? (
|
||||
<Clock className="h-4 w-4 text-blue-500 animate-spin" />
|
||||
) : (avoirVerificationResults[avoir.id]?.exists === true || avoir.nocodbVerified) ? (
|
||||
<CheckCircle className="h-4 w-4 text-green-500 cursor-help" />
|
||||
<CheckCircle className="h-4 w-4 text-green-500 cursor-help" title={`Vérifié: ${avoirVerificationResults[avoir.id]?.exists ? 'cache' : avoir.nocodbVerified ? 'validé' : 'inconnu'}`} />
|
||||
) : avoirVerificationResults[avoir.id]?.exists === false ? (
|
||||
<XCircle className="h-4 w-4 text-red-500 cursor-help" />
|
||||
) : (
|
||||
|
||||
Reference in new issue
Block a user