mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-16 20:11:08 +00:00
Adjusts relative import paths across the application to reflect recent changes in the project's directory structure. This primarily affects SFTP state management and modal components. Updates React hook dependency arrays for `useCallback` and `useEffect` to ensure proper memoization and re-execution, addressing `react-hooks/exhaustive-deps` linting rules. Improves type safety for translation function parameters by changing `Record<string, any>` to `Record<string, unknown>`. Adds the `ls` command to the allowed commands for the Claude AI assistant in local settings.
20 lines
612 B
TypeScript
20 lines
612 B
TypeScript
import { useEffect } from "react";
|
|
import type { MutableRefObject } from "react";
|
|
import { netcattyBridge } from "../../../infrastructure/services/netcattyBridge";
|
|
|
|
export const useSftpSessionCleanup = (sftpSessionsRef: MutableRefObject<Map<string, string>>) => {
|
|
useEffect(() => {
|
|
const sessionsRef = sftpSessionsRef.current;
|
|
|
|
return () => {
|
|
sessionsRef.forEach(async (sftpId) => {
|
|
try {
|
|
await netcattyBridge.get()?.closeSftp(sftpId);
|
|
} catch {
|
|
// Ignore errors when closing SFTP sessions during cleanup
|
|
}
|
|
});
|
|
};
|
|
}, [sftpSessionsRef]);
|
|
};
|