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