Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

fix(web): prevent Shiki highlighter crash on dynamic module load failure

(justin)randoneeringf48f4a478170
diff --git a/apps/web/src/lib/shiki-highlighter.ts b/apps/web/src/lib/shiki-highlighter.ts
index f7a07da70..0de7b9625 100644
--- a/apps/web/src/lib/shiki-highlighter.ts
+++ b/apps/web/src/lib/shiki-highlighter.ts
@@ -5,6 +5,7 @@ let shikiHighlighterPromise: Promise<Highlighter> | null = null;
const SHIKI_LANGUAGES = [
"bash",
+ "shellscript",
"csharp",
"cpp",
"css",
@@ -56,6 +57,11 @@ export function getSharedShikiHighlighter() {
// (worst case: one token type unhighlighted) instead of throwing at
// creation. All bundled grammars translate as of Shiki 3.9.1.
engine: createJavaScriptRegexEngine({ forgiving: true }),
+ }).catch((err) => {
+ // Reset so a subsequent call can retry rather than reusing a
+ // permanently-rejected promise.
+ shikiHighlighterPromise = null;
+ throw err;
});
}
diff --git a/apps/web/src/routes/_layout/_authenticated/dashboard/workspace/$workspaceId/project/$projectId/task/$taskId_.tsx b/apps/web/src/routes/_layout/_authenticated/dashboard/workspace/$workspaceId/project/$projectId/task/$taskId_.tsx
index cf91039a1..c132bd206 100644
--- a/apps/web/src/routes/_layout/_authenticated/dashboard/workspace/$workspaceId/project/$projectId/task/$taskId_.tsx
+++ b/apps/web/src/routes/_layout/_authenticated/dashboard/workspace/$workspaceId/project/$projectId/task/$taskId_.tsx
@@ -39,10 +39,18 @@ function RouteComponent() {
useEffect(() => {
let mounted = true;
- void getSharedShikiHighlighter().then(() => {
- if (!mounted) return;
- setIsShikiReady(true);
- });
+ void getSharedShikiHighlighter()
+ .then(() => {
+ if (!mounted) return;
+ setIsShikiReady(true);
+ })
+ .catch((err) => {
+ console.error("Failed to initialize Shiki highlighter:", err);
+ if (!mounted) return;
+ // Render the task view without syntax highlighting rather than
+ // leaving the page stuck in a permanent loading state.
+ setIsShikiReady(true);
+ });
return () => {
mounted = false;