Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Import the row fork's modules statically, which puts main back under the startup budget (#11588)

Daniel Han83c4c8cf28eb
diff --git a/studio/frontend/scripts/check-bundle-budget.ts b/studio/frontend/scripts/check-bundle-budget.ts
index b27280e2323..23ac833870a 100644
--- a/studio/frontend/scripts/check-bundle-budget.ts
+++ b/studio/frontend/scripts/check-bundle-budget.ts
@@ -461,7 +461,9 @@ function main(): number {
"Something is now imported statically that the first screen does not need. " +
"Either load it on use (React.lazy, lazyRouteComponent, or a dynamic import " +
"at the point of use), or raise BUDGET in this file in the same PR, with the " +
- "measurement that justifies it.",
+ "measurement that justifies it. If the chunk count above went up, check the " +
+ "opposite first: a dynamic import of a module the startup set already carries " +
+ "loads nothing later, and splits that module's graph into extra startup chunks.",
);
return 1;
}
diff --git a/studio/frontend/src/features/chat/components/chat-row-menu.ts b/studio/frontend/src/features/chat/components/chat-row-menu.ts
index d10ca53eda7..277c35589bf 100644
--- a/studio/frontend/src/features/chat/components/chat-row-menu.ts
+++ b/studio/frontend/src/features/chat/components/chat-row-menu.ts
@@ -13,6 +13,8 @@ import {
} from "../utils/conversation-markdown";
import { allRecordedSandboxSessionIds } from "../utils/recorded-sandbox-session";
import { liveThreadBranch } from "../utils/live-thread-head";
+import { forkChatThread } from "../api/chat-api";
+import { settleThreadScopedSettingsForCopy } from "../stores/chat-runtime-store";
import type { SidebarItem } from "../hooks/use-chat-sidebar-items";
import { listStoredChatMessages } from "../utils/chat-history-storage";
@@ -79,10 +81,6 @@ export function canForkChatRow(item: SidebarItem): boolean {
*/
export async function forkChatRow(item: SidebarItem) {
const messageId = liveThreadBranch(item.id)?.at(-1);
- const { forkChatThread } = await import("../api/chat-api");
- const { settleThreadScopedSettingsForCopy } = await import(
- "../stores/chat-runtime-store"
- );
await settleThreadScopedSettingsForCopy(item.id);
try {
// closed chats use the transaction-selected tip; open chats keep the branch visible at invocation.
diff --git a/studio/frontend/tests/sidebar-row-actions.test.ts b/studio/frontend/tests/sidebar-row-actions.test.ts
index 0be56e84186..bb284f8226d 100644
--- a/studio/frontend/tests/sidebar-row-actions.test.ts
+++ b/studio/frontend/tests/sidebar-row-actions.test.ts
@@ -31,21 +31,14 @@ test("row forks retain the visible branch across settings settlement", async ()
exports: {} as { forkChatRow: (item: { id: string }) => Promise<unknown> },
crypto,
...liveThreadHead,
- require: (specifier: string) => {
- if (specifier === "../api/chat-api") return {
- forkChatThread: async (id: string, args: { messageId?: string }) => {
- calls.push("fork");
- assert.equal(id, "source");
- assert.equal(args.messageId, open ? "older-reply" : undefined);
- },
- };
- if (specifier === "../stores/chat-runtime-store") return {
- settleThreadScopedSettingsForCopy: async () => {
- calls.push("settings");
- visible = false;
- },
- };
- throw new Error(`Unexpected module: ${specifier}`);
+ forkChatThread: async (id: string, args: { messageId?: string }) => {
+ calls.push("fork");
+ assert.equal(id, "source");
+ assert.equal(args.messageId, open ? "older-reply" : undefined);
+ },
+ settleThreadScopedSettingsForCopy: async () => {
+ calls.push("settings");
+ visible = false;
},
};
try {