Keep a server name typed during the pair lookup

The lookup's answer checked the name as it was when the code was
typed, so a name entered while it was in flight was overwritten with
the agent's hostname.
This commit is contained in:
Juan Denis committed 2026-10-10 22:01:08 -04:00
1 parent ada4d49ea4
commit 89eb7fb2e3
1 file changed
+1 -2
+1 -2
View File
@@ -588,7 +588,7 @@ const PairAgentForm = ({ groups, onClose, onClaimed }) => {
// the agent didn't supply one.
const suggestedName = res.system_info?.display_name
|| res.system_info?.hostname;
if (!name && suggestedName) setName(suggestedName);
if (suggestedName) setName((prev) => prev || suggestedName);
})
.catch((err) => {
if (cancelled) return;
@@ -598,7 +598,6 @@ const PairAgentForm = ({ groups, onClose, onClaimed }) => {
if (!cancelled) setLoading(false);
});
return () => { cancelled = true; };
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [formattedCode]);
async function handleClaim(e) {