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

Function useFolderChildren

apps/webuiapps/src/hooks/useFileSystem.ts:301–321  ·  view source on GitHub ↗
(store: FileSystemStore, folderPath: string)

Source from the content-addressed store, hash-verified

299 * Watches for changes to child nodes of a specific folder
300 */
301export function useFolderChildren(store: FileSystemStore, folderPath: string) {
302 const [children, setChildren] = useState<FileNode[]>(() => store.getChildrenByPath(folderPath));
303
304 useEffect(() => {
305 setChildren(store.getChildrenByPath(folderPath));
306
307 const unsubscribe = store.subscribe((event: FileSystemEvent) => {
308 if (
309 event.type === 'node_added' ||
310 event.type === 'node_removed' ||
311 event.type === 'store_reset'
312 ) {
313 setChildren(store.getChildrenByPath(folderPath));
314 }
315 });
316
317 return unsubscribe;
318 }, [store, folderPath]);
319
320 return children;
321}
322
323export default useFileSystem;

Callers

nothing calls this directly

Calls 2

getChildrenByPathMethod · 0.80
subscribeMethod · 0.80

Tested by

no test coverage detected