read WORKFLOW_SCHEDULES flag from backend instead of PostHog JS SDK (#5406)

This commit is contained in:
Shuchang Zheng 2026-04-07 12:25:14 -07:00 committed by GitHub
parent 2e72c2380c
commit 2bddb8dae6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 21 additions and 39 deletions

View file

@ -10,11 +10,9 @@ import {
LightningBoltIcon,
} from "@radix-ui/react-icons";
import { KeyIcon } from "@/components/icons/KeyIcon.tsx";
import { useFeatureFlag } from "@/hooks/useFeatureFlag";
function SideNav() {
const { collapsed } = useSidebarStore();
const schedulesEnabled = useFeatureFlag("WORKFLOW_SCHEDULES");
return (
<nav
@ -40,15 +38,11 @@ function SideNav() {
to: "/runs",
icon: <CounterClockwiseClockIcon className="size-6" />,
},
...(schedulesEnabled
? [
{
label: "Schedules",
to: "/schedules",
icon: <CalendarIcon className="size-6" />,
},
]
: []),
{
label: "Schedules",
to: "/schedules",
icon: <CalendarIcon className="size-6" />,
},
{
label: "Browsers",
to: "/browser-sessions",

View file

@ -1,9 +1,5 @@
import { Navigate } from "react-router-dom";
import { useFeatureFlag } from "@/hooks/useFeatureFlag";
import { ScheduleDetailPage } from "@/routes/schedules/ScheduleDetailPage";
export function ScheduleDetailRoute() {
const enabled = useFeatureFlag("WORKFLOW_SCHEDULES");
if (enabled) return <ScheduleDetailPage />;
return <Navigate to="/workflows" replace />;
return <ScheduleDetailPage />;
}

View file

@ -1,9 +1,5 @@
import { Navigate } from "react-router-dom";
import { useFeatureFlag } from "@/hooks/useFeatureFlag";
import { SchedulesPage } from "@/routes/schedules/SchedulesPage";
export function SchedulesRoute() {
const enabled = useFeatureFlag("WORKFLOW_SCHEDULES");
if (enabled) return <SchedulesPage />;
return <Navigate to="/workflows" replace />;
return <SchedulesPage />;
}

View file

@ -37,7 +37,6 @@ import { useDebugStore } from "@/store/useDebugStore";
import { useRecordingStore } from "@/store/useRecordingStore";
import { useWorkflowTitleStore } from "@/store/WorkflowTitleStore";
import { useWorkflowHasChangesStore } from "@/store/WorkflowHasChangesStore";
import { useFeatureFlag } from "@/hooks/useFeatureFlag";
import { cn } from "@/util/utils";
import { CacheKeyValuesResponse } from "@/routes/workflows/types/scriptTypes";
@ -99,7 +98,6 @@ function WorkflowHeader({
const { data: workflowRun } = useWorkflowRunQuery();
const debugStore = useDebugStore();
const recordingStore = useRecordingStore();
const schedulesEnabled = useFeatureFlag("WORKFLOW_SCHEDULES");
const workflowRunIsRunningOrQueued =
workflowRun && statusIsRunningOrQueued(workflowRun);
const [chosenCacheKeyValue, setChosenCacheKeyValue] = useState<string | null>(
@ -400,22 +398,20 @@ function WorkflowHeader({
</Tooltip>
</TooltipProvider>
)}
{schedulesEnabled && (
<Button
disabled={isRecording}
variant="tertiary"
size="lg"
onClick={onScheduleClick}
>
<ClockIcon className="mr-2 h-5 w-5" />
<span className="mr-2">Schedule</span>
{schedulesPanelOpen ? (
<ChevronUpIcon className="h-6 w-6" />
) : (
<ChevronDownIcon className="h-6 w-6" />
)}
</Button>
)}
<Button
disabled={isRecording}
variant="tertiary"
size="lg"
onClick={onScheduleClick}
>
<ClockIcon className="mr-2 h-5 w-5" />
<span className="mr-2">Schedule</span>
{schedulesPanelOpen ? (
<ChevronUpIcon className="h-6 w-6" />
) : (
<ChevronDownIcon className="h-6 w-6" />
)}
</Button>
<Button
disabled={isRecording}
variant="tertiary"