From 4c3b35565934c413131a99f100da93091219ef28 Mon Sep 17 00:00:00 2001 From: michaelschal <35957947-michaelschal@users.noreply.replit.com> Date: Mon, 8 Sep 2025 19:46:47 +0000 Subject: [PATCH 1/2] Improve how verified task statuses are displayed and remembered Update the task management page to load and display previously verified task states from cache, ensuring the verification status persists across page reloads and user interactions. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 9fcf4b21-eb0c-4e53-a567-e2ce4a6ad869 Replit-Commit-Checkpoint-Type: intermediate_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/9fcf4b21-eb0c-4e53-a567-e2ce4a6ad869/uMhb9Na --- client/src/pages/Avoirs.tsx | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/client/src/pages/Avoirs.tsx b/client/src/pages/Avoirs.tsx index 66be6c7..1adad17 100644 --- a/client/src/pages/Avoirs.tsx +++ b/client/src/pages/Avoirs.tsx @@ -130,6 +130,28 @@ export default function Avoirs() { const { toast } = useToast(); const queryClient = useQueryClient(); + // 🔄 Charger les vérifications du cache au démarrage + useEffect(() => { + const loadCachedVerifications = async () => { + if (!avoirs) return; + + const cachedResults: Record = {}; + for (const avoir of avoirs) { + if (avoir.invoiceReference?.trim() && avoir.nocodbVerified) { + // Si l'avoir est validé, marquer comme vérifié + cachedResults[avoir.id] = { exists: true, fromCache: true, permanent: true }; + } + } + + if (Object.keys(cachedResults).length > 0) { + setAvoirVerificationResults(prev => ({ ...prev, ...cachedResults })); + console.log('✅ Vérifications cachées chargées:', cachedResults); + } + }; + + loadCachedVerifications(); + }, [avoirs]); + // Fetch user profile const { data: user } = useQuery({ queryKey: ['/api/user'], @@ -1111,7 +1133,7 @@ export default function Avoirs() {
{verifyingAvoirs.has(avoir.id) ? ( - ) : avoirVerificationResults[avoir.id]?.exists === true ? ( + ) : (avoirVerificationResults[avoir.id]?.exists === true || avoir.nocodbVerified) ? ( ) : avoirVerificationResults[avoir.id]?.exists === false ? ( From 62ada8e9ccf6e595bfbda13ae6d3c17e8b7a603d Mon Sep 17 00:00:00 2001 From: michaelschal <35957947-michaelschal@users.noreply.replit.com> Date: Mon, 8 Sep 2025 19:47:38 +0000 Subject: [PATCH 2/2] Ensure verified status persists for invoices when reloading the page Re-introduces the useEffect hook to load cached verification statuses for 'avoirs' upon component mount, ensuring that the verified state is correctly displayed after a page refresh. 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 --- client/src/pages/Avoirs.tsx | 43 +++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/client/src/pages/Avoirs.tsx b/client/src/pages/Avoirs.tsx index 1adad17..b72a2a3 100644 --- a/client/src/pages/Avoirs.tsx +++ b/client/src/pages/Avoirs.tsx @@ -130,27 +130,6 @@ export default function Avoirs() { const { toast } = useToast(); const queryClient = useQueryClient(); - // 🔄 Charger les vérifications du cache au démarrage - useEffect(() => { - const loadCachedVerifications = async () => { - if (!avoirs) return; - - const cachedResults: Record = {}; - for (const avoir of avoirs) { - if (avoir.invoiceReference?.trim() && avoir.nocodbVerified) { - // Si l'avoir est validé, marquer comme vérifié - cachedResults[avoir.id] = { exists: true, fromCache: true, permanent: true }; - } - } - - if (Object.keys(cachedResults).length > 0) { - setAvoirVerificationResults(prev => ({ ...prev, ...cachedResults })); - console.log('✅ Vérifications cachées chargées:', cachedResults); - } - }; - - loadCachedVerifications(); - }, [avoirs]); // Fetch user profile const { data: user } = useQuery({ @@ -186,6 +165,28 @@ export default function Avoirs() { enabled: !!user, }); + // 🔄 Charger les vérifications du cache au démarrage + useEffect(() => { + const loadCachedVerifications = async () => { + if (!avoirs || avoirs.length === 0) return; + + const cachedResults: Record = {}; + for (const avoir of avoirs) { + if (avoir.invoiceReference?.trim() && avoir.nocodbVerified) { + // Si l'avoir est validé, marquer comme vérifié + cachedResults[avoir.id] = { exists: true, fromCache: true, permanent: true }; + } + } + + if (Object.keys(cachedResults).length > 0) { + setAvoirVerificationResults(prev => ({ ...prev, ...cachedResults })); + console.log('✅ Vérifications cachées chargées:', cachedResults); + } + }; + + loadCachedVerifications(); + }, [avoirs]); + // Create avoir mutation const createAvoirMutation = useMutation({ mutationFn: async (data: AvoirFormData) => {