the universal sandbox runtime for agents and humans. pocketenv.io
sandbox openclaw agent claude-code vercel-sandbox deno-sandbox cloudflare-sandbox atproto sprites daytona
7
fork

Configure Feed

Select the types of activity you want to include in your feed.

Prevent SSH keys form reinitialization

Use a ref to set form values only once and add defaultValues for private
and public keys

+9 -2
+9 -2
apps/web/src/pages/settings/sshkeys/SshKeys.tsx
··· 13 13 import { useNotyf } from "../../../hooks/useNotyf"; 14 14 import { useSodium } from "../../../hooks/useSodium"; 15 15 import { PUBLIC_KEY } from "../../../consts"; 16 - import { useEffect } from "react"; 16 + import { useEffect, useRef } from "react"; 17 17 import { useQueryClient } from "@tanstack/react-query"; 18 18 19 19 const sshKeysSchema = z ··· 79 79 const { mutateAsync: saveSshKeys } = useSaveSshKeyMutation(); 80 80 const { data: sshKeys } = useSshKeysQuery(data?.sandbox?.id || ""); 81 81 82 + const initializedRef = useRef(false); 83 + 82 84 const { 83 85 register, 84 86 handleSubmit, ··· 86 88 formState: { errors }, 87 89 } = useForm<SshKeysFormValues>({ 88 90 resolver: zodResolver(sshKeysSchema), 91 + defaultValues: { 92 + privateKey: "", 93 + publicKey: "", 94 + }, 89 95 }); 90 96 91 97 useEffect(() => { 92 - if (sshKeys?.data) { 98 + if (sshKeys?.data && !initializedRef.current) { 99 + initializedRef.current = true; 93 100 setValue("privateKey", sshKeys.data.privateKey.replace(/\\n/g, "\n")); 94 101 setValue("publicKey", sshKeys.data.publicKey); 95 102 }