fix: installation confirm - invalidate task cache + navigate back so status shows correctly
This commit is contained in:
@@ -74,8 +74,9 @@ export default function TicketDetailScreen() {
|
||||
},
|
||||
onSuccess: () => {
|
||||
setShowStatusPicker(false);
|
||||
refetch();
|
||||
qc.invalidateQueries({ queryKey: ['task', id] });
|
||||
qc.invalidateQueries({ queryKey: ['tasks'] });
|
||||
refetch();
|
||||
},
|
||||
onError: () => Alert.alert('Error', 'Could not update status.'),
|
||||
});
|
||||
@@ -136,12 +137,16 @@ export default function TicketDetailScreen() {
|
||||
|
||||
setInstNotes('');
|
||||
setCoords(null);
|
||||
Alert.alert('Installation Complete! ✓', 'Ticket resolved, location updated, and activation ticket created.');
|
||||
refetch();
|
||||
qc.invalidateQueries({ queryKey: ['tasks'] });
|
||||
qc.invalidateQueries({ queryKey: ['client', ticket?.clientId] });
|
||||
qc.invalidateQueries({ queryKey: ['client-tickets', ticket?.clientId] });
|
||||
setActiveTab('comments');
|
||||
// Invalidate all caches then go back to list — avoids stale UI on current screen
|
||||
await qc.invalidateQueries({ queryKey: ['tasks'] });
|
||||
await qc.invalidateQueries({ queryKey: ['task', id] });
|
||||
await qc.invalidateQueries({ queryKey: ['client', ticket?.clientId] });
|
||||
await qc.invalidateQueries({ queryKey: ['client-tickets', ticket?.clientId] });
|
||||
Alert.alert(
|
||||
'Installation Complete! ✓',
|
||||
'Ticket resolved, location recorded, and activation ticket created.',
|
||||
[{ text: 'OK', onPress: () => router.back() }]
|
||||
);
|
||||
} catch {
|
||||
Alert.alert('Error', 'Could not confirm installation. Please try again.');
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user