fix(research): preserve verified hypothesis links after partial lookup failure (RP11)

This commit is contained in:
Boki 2026-10-27 14:14:30 -04:00
parent f4cee5affa
commit 32f40ee753
3 changed files with 136 additions and 17 deletions

View file

@ -55,7 +55,7 @@ function HypothesisReference({
if (known) {
setHypothesisId(known.id);
} else {
void Promise.all(
void Promise.allSettled(
candidates.map(async item => {
const { revisions } = await researchApi.hypothesisRevisions(item.id, controller.signal);
return revisions.some(
@ -64,25 +64,22 @@ function HypothesisReference({
? item.id
: null;
})
)
.then(ids => {
if (current) {
const found = ids.find(Boolean) ?? null;
setHypothesisId(found);
if (!found) {
setError(
'The linked hypothesis revision is unavailable in the loaded project history.'
);
}
}
})
.catch(() => {
if (current) {
).then(results => {
if (current) {
const ids = results.flatMap(result =>
result.status === 'fulfilled' ? [result.value] : []
);
const found = ids.find(Boolean) ?? null;
setHypothesisId(found);
if (!found) {
setError(
'Could not resolve the linked hypothesis history. Refresh the project to try again.'
results.some(result => result.status === 'rejected')
? 'Could not resolve the linked hypothesis history. Refresh the project to try again.'
: 'The linked hypothesis revision is unavailable in the loaded project history.'
);
}
});
}
});
}
return () => {
current = false;