mirror of
https://github.com/lordmathis/lemma.git
synced 2025-11-06 07:54:22 +00:00
Reset file when workspace switch
This commit is contained in:
@@ -25,6 +25,9 @@ export const useFileNavigation = () => {
|
|||||||
// Load last opened file when workspace changes
|
// Load last opened file when workspace changes
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const initializeFile = async () => {
|
const initializeFile = async () => {
|
||||||
|
setSelectedFile(DEFAULT_FILE.path);
|
||||||
|
setIsNewFile(true);
|
||||||
|
|
||||||
const lastFile = await loadLastOpenedFile();
|
const lastFile = await loadLastOpenedFile();
|
||||||
if (lastFile) {
|
if (lastFile) {
|
||||||
handleFileSelect(lastFile);
|
handleFileSelect(lastFile);
|
||||||
@@ -33,7 +36,9 @@ export const useFileNavigation = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
initializeFile();
|
if (currentWorkspace) {
|
||||||
|
initializeFile();
|
||||||
|
}
|
||||||
}, [currentWorkspace, loadLastOpenedFile, handleFileSelect]);
|
}, [currentWorkspace, loadLastOpenedFile, handleFileSelect]);
|
||||||
|
|
||||||
return { selectedFile, isNewFile, handleFileSelect };
|
return { selectedFile, isNewFile, handleFileSelect };
|
||||||
|
|||||||
Reference in New Issue
Block a user