Compare commits

..

3 Commits

Author SHA1 Message Date
6be2c02506 fix: socket connection 2024-09-01 22:04:56 -04:00
1d92b6ea6f chore: removed logs, added comments 2024-09-01 20:06:11 -04:00
f683ff6480 fix: files not loading when creating a new project
This push contains console logs at various places where the server is emitting the event and the client is receiving the event. Please remove those before merging with production.
2024-08-31 20:31:20 -04:00
2 changed files with 9 additions and 8 deletions

View File

@ -491,13 +491,14 @@ export default function CodeEditor({
const fileCache = useRef(new Map()); const fileCache = useRef(new Map());
// Debounced function to get file content // Debounced function to get file content
const debouncedGetFile = const debouncedGetFile = useCallback(
(tabId: any, callback: any) => { debounce((tabId, callback) => {
socket?.emit('getFile', tabId, callback); socket?.emit('getFile', tabId, callback);
} // 300ms debounce delay, adjust as needed }, 300), // 300ms debounce delay, adjust as needed
[]
const selectFile = (tab: TTab) => { );
const selectFile = useCallback((tab: TTab) => {
if (tab.id === activeFileId) return; if (tab.id === activeFileId) return;
setGenerate((prev) => ({ ...prev, show: false })); setGenerate((prev) => ({ ...prev, show: false }));
@ -522,7 +523,7 @@ export default function CodeEditor({
setEditorLanguage(processFileType(tab.name)); setEditorLanguage(processFileType(tab.name));
setActiveFileId(tab.id); setActiveFileId(tab.id);
}; }, [activeFileId, tabs, debouncedGetFile]);
// Close tab and remove from tabs // Close tab and remove from tabs
const closeTab = (id: string) => { const closeTab = (id: string) => {