Improve pull request checks state accuracy

This commit is contained in:
Mattias Granlund 2024-03-20 00:31:05 +01:00
parent 1b9e6649c7
commit 9e41f63e99

View File

@ -75,12 +75,15 @@
checksStatus = await githubService.checks($pr$?.targetBranch);
lastChecksFetch = createTimeAgoStore(new Date(), true);
} catch (e: any) {
if (!e.message.includes('No commit found')) {
checksError = e.message;
// No commit found if branch has been removed or pr merged
if (e.message.includes('No commit found')) {
checksStatus = { error: 'Could not load checks' };
} else {
checksError = e.message;
toasts.error('Failed to fetch checks');
console.error(e);
}
checksStatus = undefined;
} finally {
isFetchingChecks = false;
}
@ -223,17 +226,19 @@
>
{statusLabel}
</Tag>
<Tag
icon={checksIcon}
color={checksColor}
filled={checksIcon == 'success-small'}
clickable
verticalOrientation={isLaneCollapsed}
on:mousedown={fetchChecks}
help={`Updated ${$lastChecksFetch}`}
>
{checksText}
</Tag>
{#if checksStatus !== null}
<Tag
icon={checksIcon}
color={checksColor}
filled={checksIcon == 'success-small'}
clickable
verticalOrientation={isLaneCollapsed}
on:mousedown={fetchChecks}
help={`Updated ${$lastChecksFetch}`}
>
{checksText}
</Tag>
{/if}
<Tag
icon="open-link"
color="ghost"