Skip to content

Commit 6cc233b

Browse files
samejrclaude
andcommitted
fix(webapp): stop the Colors page pulling Prisma into the client bundle
The page imported TaskRunAttemptStatus from @trigger.dev/database as a value, to derive the attempt-status list. That package wraps the Prisma client, so it can't load in a browser: the server render resolved it fine, but the route module failed client-side, which took the whole page's JavaScript with it. Three symptoms, one cause. Clicking Colors in the storybook sidebar fell back to a full document load instead of navigating. The measured ratios stayed blank, because they're read in an effect that never ran. And the theme switcher in the storybook layout was dead on that page, since a failed route module leaves the tree unhydrated. The enum's six members are written out under a type-only import instead, which is erased at build time. Every other storybook page already imports this package as types only. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 61b390a commit 6cc233b

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

  • apps/webapp/app/routes/storybook.colors

apps/webapp/app/routes/storybook.colors/route.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ import {
1616
XAxis,
1717
YAxis,
1818
} from "recharts";
19-
import { TaskRunAttemptStatus } from "@trigger.dev/database";
2019
import type {
2120
BatchTaskRunStatus,
2221
BulkActionStatus,
2322
BulkActionType,
2423
ErrorGroupStatus,
24+
TaskRunAttemptStatus,
2525
WorkerDeploymentStatus,
2626
} from "@trigger.dev/database";
2727
import type { WaitpointTokenStatus } from "@trigger.dev/core/v3";
@@ -500,7 +500,18 @@ const STACK_ICON_STATUSES = ["PENDING", "PENDING_VERSION", "DEQUEUED"] as const;
500500
unused-code pass removed them, so they live here now. */
501501
const LOG_LEVELS = ["TRACE", "DEBUG", "INFO", "WARN", "ERROR"] as const;
502502

503-
const ATTEMPT_STATUSES = Object.values(TaskRunAttemptStatus);
503+
/* Written out rather than derived from the Prisma enum: that package pulls in the
504+
client, and a value import of it here breaks client-side navigation to this
505+
page - SSR resolves it, the browser can't, and Remix falls back to a full
506+
document load. A type-only import is erased, so it costs nothing. */
507+
const ATTEMPT_STATUSES: TaskRunAttemptStatus[] = [
508+
"PENDING",
509+
"EXECUTING",
510+
"PAUSED",
511+
"FAILED",
512+
"CANCELED",
513+
"COMPLETED",
514+
];
504515

505516
const WAITPOINT_STATUSES: WaitpointTokenStatus[] = ["WAITING", "COMPLETED", "TIMED_OUT"];
506517

0 commit comments

Comments
 (0)