feat: new client onboarding wizard (3-step); fix ticket status refresh after update

This commit is contained in:
Nemo
2026-03-24 12:36:19 +08:00
parent 0ddd31ecd7
commit 58468fb986
3 changed files with 407 additions and 8 deletions

View File

@@ -72,11 +72,11 @@ export default function TicketDetailScreen() {
body: `Status changed to ${status.replace('_', ' ')} by ${who}`,
}).catch(() => {});
},
onSuccess: () => {
onSuccess: async () => {
setShowStatusPicker(false);
qc.invalidateQueries({ queryKey: ['task', id] });
qc.invalidateQueries({ queryKey: ['tasks'] });
refetch();
await qc.invalidateQueries({ queryKey: ['task', id] });
await qc.invalidateQueries({ queryKey: ['tasks'] });
await refetch();
},
onError: () => Alert.alert('Error', 'Could not update status.'),
});
@@ -137,9 +137,10 @@ export default function TicketDetailScreen() {
setInstNotes('');
setCoords(null);
// Invalidate all caches then go back to list — avoids stale UI on current screen
// Invalidate + force refetch so the status shows RESOLVED immediately
await qc.invalidateQueries({ queryKey: ['tasks'] });
await qc.invalidateQueries({ queryKey: ['task', id] });
await refetch();
await qc.invalidateQueries({ queryKey: ['client', ticket?.clientId] });
await qc.invalidateQueries({ queryKey: ['client-tickets', ticket?.clientId] });
Alert.alert(