fix: drawer open/close updates UI immediately without refresh
- Return null instead of throwing on 404 for drawer current query - Sync drawer session ID to null when drawer closes - Await query invalidation before closing dialog - Fix unused approvedBy lint error Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -121,7 +121,13 @@ export function transactionOptions(id: string | null) {
|
||||
export function currentDrawerOptions(locationId: string | null) {
|
||||
return queryOptions({
|
||||
queryKey: posKeys.drawer(locationId ?? ''),
|
||||
queryFn: () => api.get<DrawerSession>('/v1/drawer/current', { locationId }),
|
||||
queryFn: async (): Promise<DrawerSession | null> => {
|
||||
try {
|
||||
return await api.get<DrawerSession>('/v1/drawer/current', { locationId })
|
||||
} catch {
|
||||
return null // 404 = no open drawer
|
||||
}
|
||||
},
|
||||
enabled: !!locationId,
|
||||
retry: false,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user