From 028bfac35939c077b6d4e336a8757cf45ac3a50c Mon Sep 17 00:00:00 2001 From: vineyardbovines Date: Tue, 1 Sep 2026 15:00:13 -0400 Subject: [PATCH] Handle opt-out indexing timeout --- src/state/queries/starter-packs.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/state/queries/starter-packs.ts b/src/state/queries/starter-packs.ts index 7fbcc7a1e7..7ba7f8fe5e 100644 --- a/src/state/queries/starter-packs.ts +++ b/src/state/queries/starter-packs.ts @@ -113,14 +113,12 @@ export function useReferenceListOptOutMutation({ nextOptOut = result.uri } - let didReadViewerState = false - await until( + const didObserveRequestedState = await until( 5, 1e3, (value, error) => { if (error) return false - didReadViewerState = true nextOptOut = value.starterPack.list?.viewer?.referenceListOptOut // AppView ignores duplicate records and continues to expose the URI @@ -134,8 +132,8 @@ export function useReferenceListOptOutMutation({ }), ) - if (!didReadViewerState) { - throw new Error('Unable to read starter pack opt-out state') + if (!didObserveRequestedState) { + throw new Error('Timed out waiting for starter pack opt-out state') } return nextOptOut }, @@ -191,6 +189,9 @@ export function useReferenceListOptOutMutation({ } onError(error) }, + onSettled: () => { + void queryClient.invalidateQueries({queryKey}) + }, }) }