debug(missions): loud refresh diagnostic + drop disabled attr
The refresh button was suspected of being inert when loading is
somehow stuck true. Removes disabled and renders a bulletproof
click counter + loading state next to the icon:
clicks:0 · updated 14:05:12 · idle
- clicks bumps SYNCHRONOUSLY in onClick before any await, so a
non-zero counter proves the click event reaches the handler
- console.log fires alongside for devtools verification
- disabled={loading} removed; if load happens to hang, at least
the user can click again to retry
Temporary scaffolding — will collapse once the root cause is clear.
This commit is contained in:
@@ -119,6 +119,7 @@ export function MissionCanvas({
|
||||
const [deleteBusy, setDeleteBusy] = useState(false);
|
||||
const [runs, setRuns] = useState<MissionRunSummary[]>([]);
|
||||
const [lastLoadedAt, setLastLoadedAt] = useState<Date | null>(null);
|
||||
const [refreshClicks, setRefreshClicks] = useState(0);
|
||||
|
||||
const load = useCallback(async () => {
|
||||
if (!selectedId) {
|
||||
@@ -426,22 +427,26 @@ export function MissionCanvas({
|
||||
{refining ? "Refining…" : "Refine"}
|
||||
</button>
|
||||
)}
|
||||
{lastLoadedAt && (
|
||||
<span
|
||||
style={{
|
||||
fontSize: 10,
|
||||
color: "#6a6a72",
|
||||
fontFamily: mono,
|
||||
}}
|
||||
title={lastLoadedAt.toISOString()}
|
||||
>
|
||||
updated {lastLoadedAt.toLocaleTimeString()}
|
||||
</span>
|
||||
)}
|
||||
<span
|
||||
style={{
|
||||
fontSize: 10,
|
||||
color: refreshClicks > 0 ? "#5ec8d8" : "#6a6a72",
|
||||
fontFamily: mono,
|
||||
}}
|
||||
title={lastLoadedAt ? lastLoadedAt.toISOString() : "not loaded yet"}
|
||||
>
|
||||
clicks:{refreshClicks} · {lastLoadedAt ? `updated ${lastLoadedAt.toLocaleTimeString()}` : "…"} · {loading ? "loading" : "idle"}
|
||||
</span>
|
||||
<button
|
||||
type="button"
|
||||
onClick={load}
|
||||
disabled={loading}
|
||||
onClick={() => {
|
||||
setRefreshClicks((c) => c + 1);
|
||||
console.log("[MissionCanvas] refresh clicked", {
|
||||
selectedId,
|
||||
loading,
|
||||
});
|
||||
void load();
|
||||
}}
|
||||
title="Refresh"
|
||||
aria-label="Refresh"
|
||||
style={{ ...iconBtn, opacity: loading ? 0.6 : 1 }}
|
||||
|
||||
Reference in New Issue
Block a user