Handle opt-out indexing timeout

This commit is contained in:
vineyardbovines
2026-09-01 15:00:13 -04:00
parent b9e218c543
commit 028bfac359
+6 -5
View File
@@ -113,14 +113,12 @@ export function useReferenceListOptOutMutation({
nextOptOut = result.uri nextOptOut = result.uri
} }
let didReadViewerState = false const didObserveRequestedState = await until(
await until(
5, 5,
1e3, 1e3,
(value, error) => { (value, error) => {
if (error) return false if (error) return false
didReadViewerState = true
nextOptOut = value.starterPack.list?.viewer?.referenceListOptOut nextOptOut = value.starterPack.list?.viewer?.referenceListOptOut
// AppView ignores duplicate records and continues to expose the URI // AppView ignores duplicate records and continues to expose the URI
@@ -134,8 +132,8 @@ export function useReferenceListOptOutMutation({
}), }),
) )
if (!didReadViewerState) { if (!didObserveRequestedState) {
throw new Error('Unable to read starter pack opt-out state') throw new Error('Timed out waiting for starter pack opt-out state')
} }
return nextOptOut return nextOptOut
}, },
@@ -191,6 +189,9 @@ export function useReferenceListOptOutMutation({
} }
onError(error) onError(error)
}, },
onSettled: () => {
void queryClient.invalidateQueries({queryKey})
},
}) })
} }