Fixed live run page

This commit is contained in:
2026-02-07 23:36:18 +01:00
parent 6744a67931
commit 1ae88f2e22
2 changed files with 8 additions and 4 deletions
+1 -1
View File
@@ -41,7 +41,7 @@ function getLanguageExtension(lang: Language) {
} }
} }
export default function Editor({ run }: { run: LiveRun | null }) { export default function Editor({ run }: { run: LiveRun | null | undefined }) {
const [editorView, setEditorView] = useState<EditorView>(); const [editorView, setEditorView] = useState<EditorView>();
const [moves] = useActionOnce<LiveRunMove[]>(getLiveRunMoves, [run]); const [moves] = useActionOnce<LiveRunMove[]>(getLiveRunMoves, [run]);
+7 -3
View File
@@ -11,16 +11,20 @@ import { getLiveRun } from "@/modules/live-run/actions";
import ProblemCard from "@/app/problems/components/ProblemCard"; import ProblemCard from "@/app/problems/components/ProblemCard";
import ProfileCard from "./components/ProfileCard"; import ProfileCard from "./components/ProfileCard";
import { getProblem } from "@/modules/problems/actions"; import { getProblem } from "@/modules/problems/actions";
import { useParams } from "next/navigation";
export default function Run() { export default function Run() {
const [run] = useActionInterval(getLiveRun, 1000); const params = useParams<{ runId: string }>();
const [run] = useActionInterval(() => getLiveRun(params.runId), 1000, [
params,
]);
const [problem] = useAction( const [problem] = useAction(
async () => (run?.id ? getProblem(run.problem) : null), async () => (run?.id ? getProblem(run.problem) : null),
[run], [run],
); );
console.log(problem);
const chatMessages: ChatMessage[] = [ const chatMessages: ChatMessage[] = [
{ user: "Alice", message: "Nice split!", time: "1:53" }, { user: "Alice", message: "Nice split!", time: "1:53" },
{ user: "Bob", message: "Watch out for the string problem!", time: "1:54" }, { user: "Bob", message: "Watch out for the string problem!", time: "1:54" },