Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,29 @@ function EmbeddingModelCard({
const pullRequestStatus = profileStatuses.find(
(cs) => cs.contentType === "pull_request",
);
type RepositoryContentStatusValue =
(typeof githubRepositoryContentStatus.$inferSelect)["status"];
const getStatusLabel = (
status: RepositoryContentStatusValue | undefined,
enabled: boolean | undefined,
Copy link

Copilot AI Oct 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The isIngesting variable is captured from component scope, making this function dependent on component state. Consider passing isIngesting as a parameter to make the function pure and more testable.

Suggested change
enabled: boolean | undefined,
enabled: boolean | undefined,
isIngesting: boolean,

Copilot uses AI. Check for mistakes.
) => {
const effectiveStatus =
isIngesting && enabled ? "running" : (status ?? "unknown");
switch (effectiveStatus) {
case "idle":
return "Idle";
case "running":
return "Running";
case "queued":
return "Queued";
case "failed":
return "Error";
case "completed":
return "Completed";
default:
return "Unknown";
}
};

Comment on lines +235 to 256
Copy link

Copilot AI Oct 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The helper function should be extracted outside the component to avoid recreation on every render. Consider moving it above the component or creating it as a module-level function.

Suggested change
const getStatusLabel = (
status: RepositoryContentStatusValue | undefined,
enabled: boolean | undefined,
) => {
const effectiveStatus =
isIngesting && enabled ? "running" : (status ?? "unknown");
switch (effectiveStatus) {
case "idle":
return "Idle";
case "running":
return "Running";
case "queued":
return "Queued";
case "failed":
return "Error";
case "completed":
return "Completed";
default:
return "Unknown";
}
};
function getStatusLabel(
status: (typeof githubRepositoryContentStatus.$inferSelect)["status"] | undefined,
enabled: boolean | undefined,
isIngesting: boolean,
) {
const effectiveStatus =
isIngesting && enabled ? "running" : (status ?? "unknown");
switch (effectiveStatus) {
case "idle":
return "Idle";
case "running":
return "Running";
case "queued":
return "Queued";
case "failed":
return "Error";
case "completed":
return "Completed";
default:
return "Unknown";
}
}

Copilot uses AI. Check for mistakes.
return (
<div
Expand Down Expand Up @@ -278,11 +301,10 @@ function EmbeddingModelCard({
: "text-black-400"
}`}
>
{isIngesting && blobStatus.enabled
? "Running"
: blobStatus.status === "idle"
? "Idle"
: "Error"}
{getStatusLabel(
blobStatus?.status,
blobStatus?.enabled,
)}
</span>
</div>
{blobStatus?.status === "failed" &&
Expand Down Expand Up @@ -371,11 +393,10 @@ function EmbeddingModelCard({
: "text-black-400"
}`}
>
{isIngesting && pullRequestStatus.enabled
? "Running"
: pullRequestStatus.status === "idle"
? "Idle"
: "Error"}
{getStatusLabel(
pullRequestStatus?.status,
pullRequestStatus?.enabled,
)}
</span>
</div>
{pullRequestStatus?.status === "failed" &&
Expand Down