Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
fix: use state for branding (#20737)
ecmadao7df2a1c75525
diff --git a/frontend/src/react/app/layouts/SplashLayout.test.tsx b/frontend/src/react/app/layouts/SplashLayout.test.tsxnew file mode 100644index 0000000000..821d051ee9--- /dev/null+++ b/frontend/src/react/app/layouts/SplashLayout.test.tsx@@ -0,0 +1,48 @@+import { render } from "@testing-library/react";+import { beforeEach, describe, expect, test, vi } from "vitest";+import { AUTH_SIGNIN_MODULE } from "@/react/router/handles";+import { PlanType } from "@/types/proto-es/v1/subscription_service_pb";+import { SplashLayout } from "./SplashLayout";++const storeState = vi.hoisted(() => ({+ currentPlan: 0,+ isTrialing: false,+}));++vi.mock("react-router-dom", () => ({+ Outlet: () => <div data-testid="auth-page" />,+ useMatches: () => [{ handle: { name: AUTH_SIGNIN_MODULE } }],+}));++vi.mock("@/react/stores/app", () => {+ type MockState = {+ currentPlan: () => number;+ isTrialing: () => boolean;+ };+ const state = {+ currentPlan: () => storeState.currentPlan,+ isTrialing: () => storeState.isTrialing,+ } satisfies MockState;+ const useAppStore = (selector: (state: MockState) => unknown) =>+ selector(state);+ useAppStore.getState = () => state;+ return { useAppStore };+});++describe("SplashLayout", () => {+ beforeEach(() => {+ storeState.currentPlan = PlanType.FREE;+ storeState.isTrialing = false;+ });++ test("keeps the mounted auth layout stable when subscription loads during login", () => {+ const { container, rerender } = render(<SplashLayout />);++ expect(container.querySelector("img")).toBeInTheDocument();++ storeState.currentPlan = PlanType.ENTERPRISE;+ rerender(<SplashLayout />);++ expect(container.querySelector("img")).toBeInTheDocument();+ });+});diff --git a/frontend/src/react/app/layouts/SplashLayout.tsx b/frontend/src/react/app/layouts/SplashLayout.tsxindex 942b74c89c..68d47f299b 100644--- a/frontend/src/react/app/layouts/SplashLayout.tsx+++ b/frontend/src/react/app/layouts/SplashLayout.tsx@@ -1,3 +1,4 @@+import { useState } from "react";import { Outlet, useMatches } from "react-router-dom";import signinImage from "@/assets/illustration/signin.webp";import signupImage from "@/assets/illustration/signup.webp";@@ -14,9 +15,11 @@ export function SplashLayout() {matches.at(-1)?.handle as { name?: string } | undefined)?.name;- const currentPlan = useAppStore((s) => s.currentPlan());- const isTrialing = useAppStore((s) => s.isTrialing());- const showBrandingImage = currentPlan !== PlanType.ENTERPRISE || isTrialing;+ const [showBrandingImage] = useState(() => {+ const store = useAppStore.getState();+ const currentPlan = store.currentPlan();+ return currentPlan !== PlanType.ENTERPRISE || store.isTrialing();+ });return (<div className="min-h-screen overflow-hidden flex">