MCPcopy Create free account
hub / github.com/MiniMax-AI/OpenRoom / useFilePath

Function useFilePath

apps/webuiapps/src/hooks/useFileSystem.ts:279–295  ·  view source on GitHub ↗
(store: FileSystemStore, path: string)

Source from the content-addressed store, hash-verified

277 * Watches for changes to a file at a specific path
278 */
279export function useFilePath(store: FileSystemStore, path: string) {
280 const [node, setNode] = useState<FileNode | undefined>(() => store.getByPath(path));
281
282 useEffect(() => {
283 setNode(store.getByPath(path));
284
285 const unsubscribe = store.subscribe((event: FileSystemEvent) => {
286 if (event.path === path || event.type === 'store_reset') {
287 setNode(store.getByPath(path));
288 }
289 });
290
291 return unsubscribe;
292 }, [store, path]);
293
294 return node;
295}
296
297/**
298 * Folder children Hook

Callers

nothing calls this directly

Calls 2

getByPathMethod · 0.80
subscribeMethod · 0.80

Tested by

no test coverage detected