mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 08:23:34 +00:00
19 lines
510 B
TypeScript
19 lines
510 B
TypeScript
import { useMemo } from 'react';
|
|
import { ProjectsManager } from '@/lib/ProjectsManager';
|
|
import { useFS } from '@/hooks/useFS';
|
|
import { useGit } from './useGit';
|
|
|
|
/**
|
|
* Hook that provides a ProjectsManager instance.
|
|
* The ProjectsManager is memoized based on the fs instance.
|
|
*/
|
|
export function useProjectsManager() {
|
|
const { fs } = useFS();
|
|
const { git } = useGit();
|
|
|
|
const projectsManager = useMemo(() => {
|
|
return new ProjectsManager({ fs, git });
|
|
}, [fs, git]);
|
|
|
|
return projectsManager;
|
|
} |