Skip to content

chore: upgrade to storybook 9 #18983

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 22 commits into from
Aug 8, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix some react-router tests
  • Loading branch information
aslilac committed Aug 8, 2025
commit f49e72c7bd7c00efe0fb9715d1424342ae2c5dbc
2 changes: 1 addition & 1 deletion site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
"react-markdown": "9.0.3",
"react-query": "npm:@tanstack/react-query@5.77.0",
"react-resizable-panels": "3.0.3",
"react-router": "7.7.0",
"react-router": "7.8.0",
"react-syntax-highlighter": "15.6.1",
"react-textarea-autosize": "8.5.9",
"react-virtualized-auto-sizer": "1.0.24",
Expand Down
16 changes: 8 additions & 8 deletions site/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ describe("OrganizationRedirect", () => {
}),
);
const router = await renderPage();
const form = screen.getByText("Organization Settings");
const form = await screen.findByText("Organization Settings");
expect(form).toBeInTheDocument();
expect(router.state.location.pathname).toBe(
`/organizations/${MockDefaultOrganization.name}`,
Expand All @@ -94,7 +94,7 @@ describe("OrganizationRedirect", () => {
}),
);
const router = await renderPage();
const form = screen.getByText("Organization Settings");
const form = await screen.findByText("Organization Settings");
expect(form).toBeInTheDocument();
expect(router.state.location.pathname).toBe(
`/organizations/${MockOrganization2.name}`,
Expand Down
4 changes: 0 additions & 4 deletions site/src/pages/SetupPage/SetupPage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,6 @@ describe("Setup Page", () => {
path: "/setup",
element: <SetupPage />,
},
{
path: "/templates",
element: <h1>Templates</h1>,
},
],
{ initialEntries: ["/setup"] },
),
Expand Down
15 changes: 10 additions & 5 deletions site/src/pages/SetupPage/SetupPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { authMethods, createFirstUser } from "api/queries/users";
import { Loader } from "components/Loader/Loader";
import { useAuthContext } from "contexts/auth/AuthProvider";
import { useEmbeddedMetadata } from "hooks/useEmbeddedMetadata";
import { type FC, useEffect } from "react";
import { type FC, useEffect, useRef } from "react";
import { Helmet } from "react-helmet-async";
import { useMutation, useQuery } from "react-query";
import { Navigate, useNavigate } from "react-router";
import { Navigate } from "react-router";
import { pageTitle } from "utils/page";
import { sendDeploymentEvent } from "utils/telemetry";
import { SetupPageView } from "./SetupPageView";
Expand All @@ -24,7 +24,7 @@ export const SetupPage: FC = () => {
const setupIsComplete = !isConfiguringTheFirstUser;
const { metadata } = useEmbeddedMetadata();
const buildInfoQuery = useQuery(buildInfo(metadata["build-info"]));
const navigate = useNavigate();
const setupRequired = useRef(false);

useEffect(() => {
if (!buildInfoQuery.data) {
Expand All @@ -41,14 +41,20 @@ export const SetupPage: FC = () => {

// If the user is logged in, navigate to the app
if (isSignedIn) {
return <Navigate to="/" state={{ isRedirect: true }} replace />;
return setupRequired.current ? (
<Navigate to="/templates" replace />
) : (
<Navigate to="/" state={{ isRedirect: true }} replace />
);
}

// If we've already completed setup, navigate to the login page
if (setupIsComplete) {
return <Navigate to="/login" state={{ isRedirect: true }} replace />;
}

setupRequired.current = true;

return (
<>
<Helmet>
Expand All @@ -61,7 +67,6 @@ export const SetupPage: FC = () => {
onSubmit={async (firstUser) => {
await createFirstUserMutation.mutateAsync(firstUser);
await signIn(firstUser.email, firstUser.password);
navigate("/templates");
}}
/>
</>
Expand Down
Loading