Handle opt-out indexing timeout
This commit is contained in:
@@ -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})
|
||||||
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user