Only focus window on initial load
Some checks are pending
Tests / tests (push) Waiting to run

This commit is contained in:
Dustin Brett 2025-01-12 23:02:44 -08:00
parent a304b8d0a1
commit c6c2edc261
2 changed files with 3 additions and 2 deletions

View File

@ -134,6 +134,7 @@ const FileManager: FC<FileManagerProps> = ({
);
const [permission, setPermission] = useState<PermissionState>("prompt");
const requestingPermissions = useRef(false);
const focusedOnLoad = useRef(false);
const onKeyDown = useMemo(
() => (renaming === "" ? keyShortcuts() : undefined),
[keyShortcuts, renaming]
@ -207,8 +208,9 @@ const FileManager: FC<FileManagerProps> = ({
}, [currentUrl, folderActions, url]);
useEffect(() => {
if (!loading && !isDesktop && !isStartMenu) {
if (!focusedOnLoad.current && !loading && !isDesktop && !isStartMenu) {
fileManagerRef.current?.focus(PREVENT_SCROLL);
focusedOnLoad.current = true;
}
}, [isDesktop, isStartMenu, loading]);

View File

@ -49,7 +49,6 @@ export const useSnapshots = (): Snapshot => {
}
}
// TODO: Update icon but don't focus
updateFolder(dirname(savePath));
updateFolder(savePath, saveName);
} catch {