Skip to content
Merged
Show file tree
Hide file tree
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
23 changes: 18 additions & 5 deletions crates/diffcore-tauri/ui/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,15 @@ function GroupSummary({ group }: { group: FlowGroup }) {
* analysis, so the block never reflows as fields come and go between groups.
* A row the analysis never fills is dropped rather than left as dead space.
*/
function GroupReviewSummary({ group, groups }: { group: FlowGroup; groups: FlowGroup[] }) {
function GroupReviewSummary(
{ group, groups, describing }: { group: FlowGroup; groups: FlowGroup[]; describing: boolean },
) {
const focus = group.review_focus ?? [];
const hasMetadata = Boolean(
group.group_type || group.risk || group.impact || group.complexity ||
group.description || group.invariant || focus.length > 0,
);
if (!hasMetadata) return null;
if (!hasMetadata && !describing) return null;

const reservesFocus = groups.some((g) => (g.review_focus ?? []).length > 0);
const reservesDescription = groups.some((g) => g.description);
Expand Down Expand Up @@ -198,11 +200,16 @@ function GroupReviewSummary({ group, groups }: { group: FlowGroup; groups: FlowG
)}
</div>
)}
{reservesDescription && (
{describing && !group.description ? (
<p className="review-meta-description review-meta-description-pending">
<span className="refine-spinner" />
Writing group description...
</p>
) : reservesDescription ? (
<p className="review-meta-description" title={group.description ?? undefined}>
{group.description}
</p>
)}
) : null}
{reservesInvariant && (
<p className="review-meta-invariant" title={group.invariant ?? undefined}>
{group.invariant && (
Expand Down Expand Up @@ -232,6 +239,9 @@ export default function App() {
const [overview, setOverview] = useState<Pass1Response | null>(null);
const [deepAnalyses, setDeepAnalyses] = useState<Record<string, Pass2Response>>({});
const [deepAnalyzing, setDeepAnalyzing] = useState(false);
// The metadata pass runs in the background after analyze; without this the
// descriptions just appear minutes later with nothing having said they were coming.
const [describing, setDescribing] = useState(false);
// Counter to track concurrent deep analysis requests — prevents premature loading state clear
const deepAnalyzingCount = useRef(0);
const [activityJob, setActivityJob] = useState<LlmActivityJob | null>(null);
Expand Down Expand Up @@ -902,6 +912,7 @@ export default function App() {
*/
const describeGroups = useCallback(async () => {
if (!HAS_BACKEND || !llmSettings?.metadata_enabled) return;
setDescribing(true);
try {
const described = await tauriInvoke<FlowGroup[]>("describe_groups", {
repoPath: repoPath || null,
Expand All @@ -919,6 +930,8 @@ export default function App() {
// failure either: a silent catch here is indistinguishable from the pass
// working and returning nothing.
showToast(`Group descriptions unavailable: ${String(e)}`);
} finally {
setDescribing(false);
}
}, [llmSettings, repoPath, showToast]);

Expand Down Expand Up @@ -2598,7 +2611,7 @@ export default function App() {
</div>
) : (
<>
<GroupReviewSummary group={selectedGroup} groups={sortedGroups} />
<GroupReviewSummary group={selectedGroup} groups={sortedGroups} describing={describing} />
<GroupSummary group={selectedGroup} />
</>
)}
Expand Down
7 changes: 7 additions & 0 deletions crates/diffcore-tauri/ui/src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -1889,6 +1889,13 @@ body {
line-clamp: 2;
}

.review-meta .review-meta-description-pending {
display: flex;
align-items: center;
gap: 8px;
color: var(--text-muted);
}

.review-meta .review-meta-invariant {
font-size: 11px;
height: 32px;
Expand Down