diff --git a/orchestrator/src/client/pages/OrchestratorPage.tsx b/orchestrator/src/client/pages/OrchestratorPage.tsx index 08fdb99..b09df32 100644 --- a/orchestrator/src/client/pages/OrchestratorPage.tsx +++ b/orchestrator/src/client/pages/OrchestratorPage.tsx @@ -137,11 +137,11 @@ export const OrchestratorPage: React.FC = () => { ); useEffect(() => { - if (sourceFilter === "all") return; + if (isLoading || sourceFilter === "all") return; if (!sourcesWithJobs.includes(sourceFilter)) { setSourceFilter("all"); } - }, [sourceFilter, setSourceFilter, sourcesWithJobs]); + }, [isLoading, sourceFilter, setSourceFilter, sourcesWithJobs]); const handleManualImported = useCallback( async (importedJobId: string) => { diff --git a/orchestrator/src/client/pages/orchestrator/OrchestratorFilters.tsx b/orchestrator/src/client/pages/orchestrator/OrchestratorFilters.tsx index 4ded3d4..20269e9 100644 --- a/orchestrator/src/client/pages/orchestrator/OrchestratorFilters.tsx +++ b/orchestrator/src/client/pages/orchestrator/OrchestratorFilters.tsx @@ -17,7 +17,7 @@ import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs"; import { sourceLabel } from "@/lib/utils"; import type { JobSource } from "../../../shared/types"; -import { defaultSortDirection, orderedSources, sortLabels, tabs } from "./constants"; +import { defaultSortDirection, orderedFilterSources, sortLabels, tabs } from "./constants"; import type { FilterTab, JobSort } from "./constants"; interface OrchestratorFiltersProps { @@ -45,7 +45,6 @@ export const OrchestratorFilters: React.FC = ({ sort, onSortChange, }) => { - const orderedFilterSources: JobSource[] = [...orderedSources, "manual"]; const visibleSources = orderedFilterSources.filter((source) => sourcesWithJobs.includes(source)); return ( diff --git a/orchestrator/src/client/pages/orchestrator/constants.ts b/orchestrator/src/client/pages/orchestrator/constants.ts index 0e05337..b79398a 100644 --- a/orchestrator/src/client/pages/orchestrator/constants.ts +++ b/orchestrator/src/client/pages/orchestrator/constants.ts @@ -4,6 +4,7 @@ export const DEFAULT_PIPELINE_SOURCES: JobSource[] = ["gradcracker", "indeed", " export const PIPELINE_SOURCES_STORAGE_KEY = "jobops.pipeline.sources"; export const orderedSources: JobSource[] = ["gradcracker", "indeed", "linkedin", "ukvisajobs"]; +export const orderedFilterSources: JobSource[] = [...orderedSources, "manual"]; export const statusTokens: Record = { discovered: { diff --git a/orchestrator/src/client/pages/orchestrator/utils.ts b/orchestrator/src/client/pages/orchestrator/utils.ts index 1ddbb11..0f9da71 100644 --- a/orchestrator/src/client/pages/orchestrator/utils.ts +++ b/orchestrator/src/client/pages/orchestrator/utils.ts @@ -1,5 +1,5 @@ import type { AppSettings, Job, JobSource } from "../../../shared/types"; -import { orderedSources } from "./constants"; +import { orderedFilterSources, orderedSources } from "./constants"; import type { FilterTab, JobSort } from "./constants"; const dateValue = (value: string | null) => { @@ -89,14 +89,12 @@ export const getJobCounts = (jobs: Job[]): Record => { return byTab; }; -const orderedSourceFilters: JobSource[] = [...orderedSources, "manual"]; - export const getSourcesWithJobs = (jobs: Job[]): JobSource[] => { const seen = new Set(); for (const job of jobs) { seen.add(job.source); } - return orderedSourceFilters.filter((source) => seen.has(source)); + return orderedFilterSources.filter((source) => seen.has(source)); }; export const getEnabledSources = (settings: AppSettings | null): JobSource[] => {