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 [deleteBusy, setDeleteBusy] = useState(false);
|
||||||
const [runs, setRuns] = useState<MissionRunSummary[]>([]);
|
const [runs, setRuns] = useState<MissionRunSummary[]>([]);
|
||||||
const [lastLoadedAt, setLastLoadedAt] = useState<Date | null>(null);
|
const [lastLoadedAt, setLastLoadedAt] = useState<Date | null>(null);
|
||||||
|
const [refreshClicks, setRefreshClicks] = useState(0);
|
||||||
|
|
||||||
const load = useCallback(async () => {
|
const load = useCallback(async () => {
|
||||||
if (!selectedId) {
|
if (!selectedId) {
|
||||||
@@ -426,22 +427,26 @@ export function MissionCanvas({
|
|||||||
{refining ? "Refining…" : "Refine"}
|
{refining ? "Refining…" : "Refine"}
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
{lastLoadedAt && (
|
<span
|
||||||
<span
|
style={{
|
||||||
style={{
|
fontSize: 10,
|
||||||
fontSize: 10,
|
color: refreshClicks > 0 ? "#5ec8d8" : "#6a6a72",
|
||||||
color: "#6a6a72",
|
fontFamily: mono,
|
||||||
fontFamily: mono,
|
}}
|
||||||
}}
|
title={lastLoadedAt ? lastLoadedAt.toISOString() : "not loaded yet"}
|
||||||
title={lastLoadedAt.toISOString()}
|
>
|
||||||
>
|
clicks:{refreshClicks} · {lastLoadedAt ? `updated ${lastLoadedAt.toLocaleTimeString()}` : "…"} · {loading ? "loading" : "idle"}
|
||||||
updated {lastLoadedAt.toLocaleTimeString()}
|
</span>
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={load}
|
onClick={() => {
|
||||||
disabled={loading}
|
setRefreshClicks((c) => c + 1);
|
||||||
|
console.log("[MissionCanvas] refresh clicked", {
|
||||||
|
selectedId,
|
||||||
|
loading,
|
||||||
|
});
|
||||||
|
void load();
|
||||||
|
}}
|
||||||
title="Refresh"
|
title="Refresh"
|
||||||
aria-label="Refresh"
|
aria-label="Refresh"
|
||||||
style={{ ...iconBtn, opacity: loading ? 0.6 : 1 }}
|
style={{ ...iconBtn, opacity: loading ? 0.6 : 1 }}
|
||||||
|
|||||||
Reference in New Issue
Block a user