Live runs refreshing

This commit is contained in:
2026-02-08 14:13:19 +01:00
parent 74ba95f6c9
commit bcea0c495c
2 changed files with 4 additions and 3 deletions
+2 -1
View File
@@ -11,6 +11,7 @@ import { Badge } from "@/components/ui/badge";
import { cn } from "@/lib/utils"; import { cn } from "@/lib/utils";
import { Problem } from "@/modules/problems/types"; import { Problem } from "@/modules/problems/types";
import { Clock, Zap, Users, Code } from "lucide-react"; import { Clock, Zap, Users, Code } from "lucide-react";
import axios from "axios";
const ProblemCard = ({ const ProblemCard = ({
problem, problem,
@@ -100,7 +101,7 @@ const ProblemCard = ({
<Button <Button
size="icon" size="icon"
onClick={async () => { onClick={async () => {
await fetch(`http://127.0.0.1:63780/start-run/${problem.id}`); await axios.get(`http://127.0.0.1:63780/start-run/${problem.id}`);
window.open("vscode://", "_blank"); window.open("vscode://", "_blank");
}} }}
> >
+2 -2
View File
@@ -9,12 +9,12 @@ import {
TableRow, TableRow,
} from "@/components/ui/table"; } from "@/components/ui/table";
import LiveRunRow from "./components/LiveRunRow"; import LiveRunRow from "./components/LiveRunRow";
import useAction from "@/hook/use-action"; import useAction, { useActionInterval } from "@/hook/use-action";
import { getLiveRuns } from "@/modules/live-run/actions"; import { getLiveRuns } from "@/modules/live-run/actions";
import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group"; import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group";
export default function LiveRuns() { export default function LiveRuns() {
const [liveRuns] = useAction(getLiveRuns); const [liveRuns] = useActionInterval(getLiveRuns, 1500);
// Sort top runners (status === 'pb') to the top // Sort top runners (status === 'pb') to the top
const sortedRuns = [...(liveRuns || [])]; const sortedRuns = [...(liveRuns || [])];