mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-12-06 19:03:43 +00:00
fix(vault): keep KnownHostsManager mounted after first visit
Addresses Codex P2 review finding on PR #4481: - Keep KnownHostsManager lazy on cold startup (unmounted until first visit) - Once visited, keep it mounted and hidden via display:none so hasScannedRef is not reset on section switches and deleted OpenSSH entries are not silently re-imported
This commit is contained in:
1 parent
35bb8b1e99
commit
0ef9b23556
1 file changed
+8
-2
@@ -570,6 +570,12 @@ export function VaultViewLayout({ ctx }: { ctx: VaultViewLayoutContext }) {
|
||||
const [isMoveHostsOpen, setIsMoveHostsOpen] = React.useState(false);
|
||||
const [moveTargetGroup, setMoveTargetGroup] = React.useState("");
|
||||
const [isSidebarResizing, setIsSidebarResizing] = React.useState(false);
|
||||
const [hasMountedKnownHosts, setHasMountedKnownHosts] = React.useState(
|
||||
currentSection === "knownhosts",
|
||||
);
|
||||
if (currentSection === "knownhosts" && !hasMountedKnownHosts) {
|
||||
setHasMountedKnownHosts(true);
|
||||
}
|
||||
const keyListRef = React.useRef(keys);
|
||||
keyListRef.current = keys;
|
||||
const newHostActionsRef = React.useRef<HTMLDivElement>(null);
|
||||
@@ -1581,8 +1587,8 @@ export function VaultViewLayout({ ctx }: { ctx: VaultViewLayoutContext }) {
|
||||
</LazyLoadBoundary>
|
||||
)}
|
||||
{/* Mount KnownHostsManager lazily on first visit, then keep hidden with CSS */}
|
||||
{currentSection === "knownhosts" ? (
|
||||
<div style={{ display: "contents" }}>
|
||||
{hasMountedKnownHosts ? (
|
||||
<div style={{ display: currentSection === "knownhosts" ? "contents" : "none" }}>
|
||||
<Suspense fallback={<VaultSectionLoading />}>
|
||||
{knownHostsManagerElement}
|
||||
</Suspense>
|
||||
|
||||
Reference in new issue
Block a user