const { loadFile, isLoading, error } = useFileSessionLoader<QASessionFile, Question[]>({
parseFile: (data) => [...data.questions.active, ...data.questions.answered],
onLoad: (questions, fileId) => {
setQuestions(questions);
setFileId(fileId);
},
onError: (err) => console.error('Failed to load:', err),
});
// In FileManager onFileOpen handler:
const handleOpenFile = (file: FileEntry) => loadFile(file);
useFileSessionLoader - Hook for loading session files from S3
Handles fetching file URLs from the file cache, downloading the JSON content, parsing it with a custom parser function, and calling the onLoad callback.