fix: deploy keys modal crash on null/undefined arrays

- sshmanager/deploy.go: initialize DeployResult with empty slices
  instead of nil to prevent null serialization in JSON
- Machines.tsx: use ?? [] fallback for messages and errors arrays
  in deploy keys modal to handle null/undefined gracefully
This commit is contained in:
2026-07-09 20:38:41 -04:00
parent c0bf16f132
commit 179b2d8fbd
3 changed files with 176 additions and 3 deletions
+2 -2
View File
@@ -660,7 +660,7 @@ export default function Machines() {
<div className="rounded-card bg-emerald-500/10 border border-emerald-500/30 p-4">
<p className="text-sm font-medium text-emerald-400 mb-2">Deployment successful</p>
<ul className="space-y-1">
{deployModal.result.messages.map((msg, i) => (
{(deployModal.result.messages ?? []).map((msg, i) => (
<li key={i} className="text-xs text-fg-muted flex items-start gap-2">
<span className="text-emerald-400 mt-0.5">&#10003;</span>
{msg}
@@ -672,7 +672,7 @@ export default function Machines() {
<div className="rounded-card bg-rose-500/10 border border-rose-500/30 p-4">
<p className="text-sm font-medium text-rose-400 mb-2">Deployment failed</p>
<ul className="space-y-1">
{deployModal.result.errors.map((err, i) => (
{(deployModal.result.errors ?? []).map((err, i) => (
<li key={i} className="text-xs text-fg-muted flex items-start gap-2">
<span className="text-rose-400 mt-0.5">&#10007;</span>
{err}