app/lib/editor/head.server.ts
17 lines and 1 functions in DrDustinEdwards/dustinedwards-info, at commit 1590ba4 on 2026-10-24. This file on GitHub.
Functions
| Function | Lines | Complexity | Covered | CRAP | Mutation |
|---|---|---|---|---|---|
| readHead | 10 to 19 | 2 | No data: no coverage report in this map | No data: no coverage report in this map | No data: no mutants in this code |
Imports
It imports app/lib/editor/publish.server.ts, app/lib/error-message.mjs. Imported by app/routes/admin.posts.$slug.edit.tsx, app/routes/admin.posts.new.tsx.
Source
import { currentHead } from "~/lib/editor/publish.server";
import { errorMessage } from "~/lib/error-message.mjs";
type HeadEnv = Parameters<typeof currentHead>[0];
/**
* For a loader that must render with no head. The error travels with the empty sha, so the editor
* names what failed rather than guessing a missing token.
*/
export async function readHead(
env: HeadEnv,
): Promise<{ headSha: string; headError: string | null }> {
try {
return { headSha: await currentHead(env), headError: null };
} catch (error) {
console.error(JSON.stringify({ alert: "editor-head-read-failed", detail: errorMessage(error) }));
return { headSha: "", headError: errorMessage(error) };
}
}