Skip to content

Commit 296dd0f

Browse files
committed
fix(webapp): stop the smart-column sample showing 'No runs' while loading
The sample panel treated 'fetch not finished' the same as 'no runs found', so it flashed (or stuck on) 'No runs to sample' before the request resolved. It now shows a loading state until the fetch completes and reloads on each open, so 'No runs to sample' only appears when there genuinely are none.
1 parent e40a6fc commit 296dd0f

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

apps/webapp/app/components/runs/v3/AddSmartColumnDialog.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,15 @@ export function AddSmartColumnDialog({
7878
}, [organization.slug, project.slug, environment.slug, currentSearch]);
7979

8080
useEffect(() => {
81-
if (open && sample.state === "idle" && sample.data === undefined) {
81+
if (open && sample.state === "idle") {
8282
sample.load(sampleUrl);
8383
}
8484
// eslint-disable-next-line react-hooks/exhaustive-deps
8585
}, [open, sampleUrl]);
8686

8787
const effectiveLabel = labelEdited ? label : labelFromPath(path);
8888

89+
const sampleLoaded = sample.data !== undefined && sample.state === "idle";
8990
const sampleRuns = sample.data?.runs ?? [];
9091
const clampedIndex = sampleRuns.length > 0 ? Math.min(sampleIndex, sampleRuns.length - 1) : 0;
9192
const sampleRun = sampleRuns[clampedIndex] ?? null;
@@ -210,7 +211,7 @@ export function AddSmartColumnDialog({
210211
/>
211212
)}
212213
</div>
213-
{sample.state === "loading" ? (
214+
{!sampleLoaded ? (
214215
<Paragraph variant="extra-small" className="text-text-dimmed">
215216
Loading…
216217
</Paragraph>

0 commit comments

Comments
 (0)