MCPcopy Create free account
hub / github.com/Datakitpage/Datakit / triggerAnalysis

Function triggerAnalysis

frontend/src/hooks/useColumnStats.ts:49–76  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

47
48 // Manual trigger function
49 const triggerAnalysis = async () => {
50 if (!file || !currentFileId || loadingRef.current || isAnalyzing) {
51 return;
52 }
53
54 loadingRef.current = true;
55 setIsLoading(true);
56 setError(null);
57
58 try {
59 console.log('[useColumnStats] Manual analysis triggered for:', file.fileName);
60
61 const tableName = file.tableName;
62 if (!tableName) {
63 throw new Error('Table name not found for file');
64 }
65
66 await analyzeFile(currentFileId, tableName);
67
68 console.log('[useColumnStats] Manual analysis completed successfully');
69 } catch (err) {
70 console.error('[useColumnStats] Manual analysis failed:', err);
71 setError(err instanceof Error ? err.message : 'Failed to load column statistics');
72 } finally {
73 loadingRef.current = false;
74 setIsLoading(false);
75 }
76 };
77
78 useEffect(() => {
79 // Reset state when file changes

Callers 2

useAutoAnalysisFunction · 0.85
HomeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected