From 0973d2d714e2eaad430bb5063136c7e0f821ec8f Mon Sep 17 00:00:00 2001 From: MarekWo Date: Tue, 24 Mar 2026 18:25:03 +0100 Subject: [PATCH] fix(contacts): invalidate contacts cache after push/move operations The /api/contacts/detailed endpoint has a 60s cache. Without invalidation after push-to-device or move-to-cache, the UI showed stale data until cache expired, making it look like the operation didn't work. Co-Authored-By: Claude Opus 4.6 --- app/routes/api.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/routes/api.py b/app/routes/api.py index a70f0c8..27d6f08 100644 --- a/app/routes/api.py +++ b/app/routes/api.py @@ -2747,6 +2747,8 @@ def push_contact_to_device(public_key): return jsonify({'success': False, 'error': 'Device manager unavailable'}), 500 result = dm.push_to_device(public_key.strip().lower()) + if result['success']: + invalidate_contacts_cache() status = 200 if result['success'] else 400 return jsonify(result), status except Exception as e: @@ -2763,6 +2765,8 @@ def move_contact_to_cache(public_key): return jsonify({'success': False, 'error': 'Device manager unavailable'}), 500 result = dm.move_to_cache(public_key.strip().lower()) + if result['success']: + invalidate_contacts_cache() status = 200 if result['success'] else 400 return jsonify(result), status except Exception as e: