Skip to content

Commit

Permalink
fix(initialPath): change initial path's logic to wait for the files r…
Browse files Browse the repository at this point in the history
…esponse and then update current path
  • Loading branch information
Saifullah-dev committed Dec 30, 2024
1 parent 8109752 commit 5238be9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion frontend/src/contexts/FileNavigationContext.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const FileNavigationProvider = ({ children, initialPath }) => {
}, [files, currentPath]);

useEffect(() => {
if (!isMountRef.current) {
if (!isMountRef.current && Array.isArray(files) && files.length > 0) {
setCurrentPath(files.some((file) => file.path === initialPath) ? initialPath : '');
isMountRef.current = true;
}
Expand Down

0 comments on commit 5238be9

Please sign in to comment.