Skip to content

Commit 7ffc8f0

Browse files
committed
feat: add IncompatibleWorkspace story for visual regression testing
1 parent 5e30b3a commit 7ffc8f0

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

src/browser/App.stories.tsx

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,65 @@ export const ManyWorkspaces: Story = {
377377
},
378378
};
379379

380+
/**
381+
* Story demonstrating the incompatible workspace error view.
382+
*
383+
* When a user downgrades to an older version of mux that doesn't support
384+
* a workspace's runtime configuration, the workspace shows an error message
385+
* instead of crashing. This ensures graceful degradation.
386+
*/
387+
export const IncompatibleWorkspace: Story = {
388+
render: () => {
389+
const workspaceId = "incompatible-ws";
390+
391+
const projects = new Map<string, ProjectConfig>([
392+
[
393+
"/home/user/projects/my-app",
394+
{
395+
workspaces: [
396+
{ path: "/home/user/.mux/src/my-app/main", id: "my-app-main", name: "main" },
397+
{
398+
path: "/home/user/.mux/src/my-app/incompatible",
399+
id: workspaceId,
400+
name: "incompatible",
401+
},
402+
],
403+
},
404+
],
405+
]);
406+
407+
const workspaces: FrontendWorkspaceMetadata[] = [
408+
{
409+
id: "my-app-main",
410+
name: "main",
411+
projectPath: "/home/user/projects/my-app",
412+
projectName: "my-app",
413+
namedWorkspacePath: "/home/user/.mux/src/my-app/main",
414+
runtimeConfig: DEFAULT_RUNTIME_CONFIG,
415+
},
416+
{
417+
id: workspaceId,
418+
name: "incompatible",
419+
projectPath: "/home/user/projects/my-app",
420+
projectName: "my-app",
421+
namedWorkspacePath: "/home/user/.mux/src/my-app/incompatible",
422+
runtimeConfig: DEFAULT_RUNTIME_CONFIG,
423+
// This field is set when a workspace has an incompatible runtime config
424+
incompatibleRuntime:
425+
"This workspace was created with a newer version of mux.\nPlease upgrade mux to use this workspace.",
426+
},
427+
];
428+
429+
return (
430+
<AppWithMocks
431+
projects={projects}
432+
workspaces={workspaces}
433+
selectedWorkspaceId={workspaceId}
434+
/>
435+
);
436+
},
437+
};
438+
380439
/**
381440
* Story demonstrating all possible UI indicators in the project sidebar.
382441
*

0 commit comments

Comments
 (0)