Compare commits

..

9 Commits

2 changed files with 8 additions and 9 deletions

View File

@ -491,14 +491,13 @@ 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 = useCallback( const debouncedGetFile =
debounce((tabId, callback) => { (tabId: any, callback: any) => {
socket?.emit('getFile', tabId, callback); socket?.emit('getFile', tabId, callback);
}, 300), // 300ms debounce delay, adjust as needed } // 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 }));
@ -523,7 +522,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) => {

View File

@ -44,7 +44,7 @@ export default function RunButtonModal({
"pip install -r requirements.txt && streamlit run main.py --server.runOnSave true" "pip install -r requirements.txt && streamlit run main.py --server.runOnSave true"
); );
} else { } else {
createNewTerminal("yarn install && yarn dev"); createNewTerminal("yarn install && yarn dev");
} }
} else { } else {
toast.error("You reached the maximum # of terminals."); toast.error("You reached the maximum # of terminals.");