mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-26 09:52:11 +03:00
fix(docs+ui): add MDX frontmatter to Codex CLI guide, fix setState-in-effect lint
- docs/guides/CODEX-CLI-CONFIGURATION.md was missing the YAML frontmatter block required by fumadocs (title/version/lastUpdated), causing the production build to fail with "invalid frontmatter" MDX error. - CodexCliGuideModal.tsx called setLoading/setError synchronously in a useEffect body, triggering the react-hooks/set-state-in-effect lint error. Refactored to an internal async function with an `cancelled` guard to prevent state updates on unmounted components.
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
---
|
||||
title: "Codex CLI — Configuration with OmniRoute"
|
||||
version: 3.8.16
|
||||
lastUpdated: 2026-06-08
|
||||
---
|
||||
|
||||
# Codex CLI — Configuration with OmniRoute
|
||||
|
||||
Complete guide for using the Codex CLI pointed at OmniRoute as an OpenAI-compatible backend.
|
||||
|
||||
@@ -125,17 +125,26 @@ export default function CodexCliGuideModal({ isOpen, onClose }: CodexCliGuideMod
|
||||
useEffect(() => {
|
||||
if (!isOpen || content) return;
|
||||
|
||||
setLoading(true);
|
||||
setError(false);
|
||||
|
||||
fetch("/api/docs/codex-cli")
|
||||
.then((res) => {
|
||||
let cancelled = false;
|
||||
const load = async () => {
|
||||
setLoading(true);
|
||||
setError(false);
|
||||
try {
|
||||
const res = await fetch("/api/docs/codex-cli");
|
||||
if (!res.ok) throw new Error(`${res.status}`);
|
||||
return res.json() as Promise<{ content: string }>;
|
||||
})
|
||||
.then((data) => setContent(data.content))
|
||||
.catch(() => setError(true))
|
||||
.finally(() => setLoading(false));
|
||||
const data = (await res.json()) as { content: string };
|
||||
if (!cancelled) setContent(data.content);
|
||||
} catch {
|
||||
if (!cancelled) setError(true);
|
||||
} finally {
|
||||
if (!cancelled) setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
void load();
|
||||
return () => {
|
||||
cancelled = true;
|
||||
};
|
||||
}, [isOpen, content]);
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user