Automate browser based workflows with AI
Python aiapiautomationbrowserbrowser-automationcomputergptllmplaywrightpowerautomatepuppeteerpythonrpaseleniumvisionworkflow
Alert when the weekly test-durations refresh stops landing (SKY-16225) (#8544)
Aaron Perez26bd1d2cc7e8
diff --git a/skyvern-frontend/src/components/Status404.tsx b/skyvern-frontend/src/components/Status404.tsxindex 3c6c4b91c..d5293e907 100644--- a/skyvern-frontend/src/components/Status404.tsx+++ b/skyvern-frontend/src/components/Status404.tsx@@ -1,6 +1,20 @@+import { useEffect } from "react";++import { useNotFoundStore } from "@/store/NotFoundStore";import "./Status404.css";function Status404() {+ const showNotFound = useNotFoundStore((state) => state.showNotFound);+ const hideNotFound = useNotFoundStore((state) => state.hideNotFound);++ // Full-bleed routes (the studio, the editor) hide the app header, and a run+ // URL keeps matching them after the run resolves to a 404. Announce the+ // not-found screen so the shell can bring its chrome back.+ useEffect(() => {+ showNotFound();+ return hideNotFound;+ }, [showNotFound, hideNotFound]);+return (<divclassName="relative z-50 flex w-full items-center justify-center bg-background"diff --git a/skyvern-frontend/src/routes/root/Header.tsx b/skyvern-frontend/src/routes/root/Header.tsxindex 585108118..3e38962bc 100644--- a/skyvern-frontend/src/routes/root/Header.tsx+++ b/skyvern-frontend/src/routes/root/Header.tsx@@ -2,7 +2,7 @@ import { NavigationHamburgerMenu } from "./NavigationHamburgerMenu";import { useSidebarHidden } from "./useSidebarHidden";function Header() {- const sidebarHidden = useSidebarHidden();+ const sidebarHidden = useSidebarHidden({ revealOnNotFound: true });if (sidebarHidden) {return null;diff --git a/skyvern-frontend/src/routes/root/useSidebarHidden.ts b/skyvern-frontend/src/routes/root/useSidebarHidden.tsindex ef2191d77..0c535d591 100644--- a/skyvern-frontend/src/routes/root/useSidebarHidden.ts+++ b/skyvern-frontend/src/routes/root/useSidebarHidden.ts@@ -3,14 +3,20 @@ import { useMatch, useSearchParams } from "react-router-dom";import { useWorkflowStudioEnabled } from "@/hooks/useWorkflowStudioEnabled";import { useAgentsPathMatch } from "@/routes/workflows/useAgentsPathMatch";import { useStudioRunRouteMatch } from "@/routes/workflows/useStudioRunRouteMatch";+import { useNotFoundVisible } from "@/store/NotFoundStore";type Options = {hideBrowserSessions?: boolean;+ revealOnNotFound?: boolean;};-function useSidebarHidden({ hideBrowserSessions = false }: Options = {}) {+function useSidebarHidden({+ hideBrowserSessions = false,+ revealOnNotFound = false,+}: Options = {}) {const [searchParams] = useSearchParams();const embed = searchParams.get("embed");+ const notFoundVisible = useNotFoundVisible();const studioEnabled = useWorkflowStudioEnabled();const runStudioMatch = useStudioRunRouteMatch();const workflowEditMatch = useAgentsPathMatch("/:workflowPermanentId/edit");@@ -30,6 +36,19 @@ function useSidebarHidden({ hideBrowserSessions = false }: Options = {}) {"/browser-session/:browserSessionId/*",);+ // Embedded views are chrome-free by contract, so they stay hidden even on a+ // not-found screen.+ if (embed === "true") {+ return true;+ }++ // The route still looks full-bleed, but a not-found screen has nothing to+ // fill the viewport with — and hiding the chrome strands the user with no way+ // to switch to the organization the linked resource belongs to.+ if (revealOnNotFound && notFoundVisible) {+ return false;+ }+return Boolean((studioEnabled && runStudioMatch) ||workflowEditMatch ||@@ -38,9 +57,7 @@ function useSidebarHidden({ hideBrowserSessions = false }: Options = {}) {workflowBlockBuildMatch ||workflowDebugMatch ||workflowBlockDebugMatch ||- (hideBrowserSessions &&- (browserSessionMatch || nestedBrowserSessionMatch)) ||- embed === "true",+ (hideBrowserSessions && (browserSessionMatch || nestedBrowserSessionMatch)),);}diff --git a/skyvern-frontend/src/store/NotFoundStore.ts b/skyvern-frontend/src/store/NotFoundStore.tsnew file mode 100644index 000000000..5eb5362d4--- /dev/null+++ b/skyvern-frontend/src/store/NotFoundStore.ts@@ -0,0 +1,24 @@+import { create } from "zustand";++type NotFoundStore = {+ // A count rather than a flag: route transitions can mount the next not-found+ // screen before the previous one unmounts, and StrictMode double-invokes the+ // registering effect.+ visibleCount: number;+ showNotFound: () => void;+ hideNotFound: () => void;+};++const useNotFoundStore = create<NotFoundStore>((set) => ({+ visibleCount: 0,+ showNotFound: () =>+ set((state) => ({ visibleCount: state.visibleCount + 1 })),+ hideNotFound: () =>+ set((state) => ({ visibleCount: Math.max(0, state.visibleCount - 1) })),+}));++function useNotFoundVisible(): boolean {+ return useNotFoundStore((state) => state.visibleCount > 0);+}++export { useNotFoundStore, useNotFoundVisible };