SurfSense/surfsense_web/hooks/use-automations.ts
Anish Sarkar a8c1fb660d feat(rename): complete searchSpace to workspace transition across frontend and backend
- Introduced a comprehensive specification for renaming `searchSpace` to `workspace` in `surfsense_web` and `surfsense_desktop`, ensuring all TypeScript identifiers, React props, and local data structures are updated.
- Implemented migration shims for persisted local state to prevent data loss during the transition.
- Updated observability metrics and IPC channels to reflect the new naming convention.
- Removed legacy `active-search-space` module and replaced it with `active-workspace` to maintain consistency.
- Ensured no behavioral changes or data loss for users during the renaming process.
2026-07-06 15:12:40 +05:30

24 lines
722 B
TypeScript

"use client";
import { useAtomValue } from "jotai";
import { automationsListAtom } from "@/atoms/automations/automations-query.atoms";
/**
* List automations in the active workspace (first page).
* Pagination knobs live in detail/list hooks below; v1 surfaces only the
* first page since automation counts are expected to be small.
*/
export function useAutomations() {
const { data, isLoading, error, refetch } = useAutomationsRaw();
return {
automations: data?.items ?? [],
total: data?.total ?? 0,
loading: isLoading,
error,
refresh: refetch,
};
}
// Exposed for callers that prefer the raw react-query result shape.
export function useAutomationsRaw() {
return useAtomValue(automationsListAtom);
}