[Bug] Add Cluster dialog keeps the previous cluster's name and credentials
Describe the bug
The Add Cluster dialog keeps the previous submission's values. AddClusterModal is mounted permanently and hides itself with if (!isOpen) return null, but its four form states (Proxmox, XCP-ng, PBS, ESXi) are created once with useState and never reset. Nothing clears them on submit, on close, or on the next open.
Two consequences:
- Wrong cluster name. Reopening Add Cluster shows the previous cluster's Name, Host, User and settings. If the operator changes Host and credentials but does not notice Name is already filled, the new cluster is saved under the previous cluster's
name. On my instance three clusters ended up withname = pxve0. The sidebar hid this because Rename writes a separatedisplay_name. Side effects: cluster pickers that rendername(see #787) show identical entries, and because the per-cluster logger is keyed onname, all three clusters write into each other's log files. - Credentials retained. The previous cluster's root password and SSH key stay in component state for the life of the tab and are pre-filled into the next Add form, so they are sent to whatever host is typed next unless the operator retypes them. The same applies after Re-configure: the dialog pre-fills from that cluster's config and keeps it after close.
Steps to Reproduce
- Add a cluster: Name
alpha, Hosta.example, passwordsecret. - Open Add Cluster again. All fields still show
alpha,a.example, and the password field is filled. - Change Host to
b.example, enter its password, submit without touching Name. - The second cluster is saved with
name = alpha. Both cluster log files carry thePegaProx_alphatag and mirror each other.
Expected behavior
Every field is empty (defaults only) each time Add Cluster opens. Nothing typed into a previous Add or Re-configure survives closing the dialog.
Environment
- PegaProx Version: 1.1.1
- Installation Method: Docker (official image, Swarm service)
- OS: Docker Swarm host on Proxmox VE; client on Nobara (latest)
- Browser: Firefox (latest)
- Behind Reverse Proxy? Traefik (no container ports published)
- UI? Modern Layout
Logs
Three clusters, three log files, all tagged with the first cluster's name; two of the files are byte-identical in size because they receive the same stream.
##### 3435a719.log
[2026-09-07 20:52:21,904] [PegaProx_pxve0] INFO: Starting balance check for cluster: pxve0
##### a6707432.log
[2026-09-07 20:52:21,904] [PegaProx_pxve0] INFO: Starting balance check for cluster: pxve0
##### a7ab8805.log
[2026-09-07 20:52:00,431] [PegaProx_pxve0] DEBUG: Node pxve4: CPU 0.88%, RAM 79.43% (49.51 GB/62.33 GB), Score 104.42, Status: online
Checklist
- [x] I have searched existing issues to make sure this is not a duplicate
- [x] I am using the latest version of PegaProx
I have a fix ready (reset all four form objects when the dialog closes) and will open a PR referencing this issue.
Reproduced — you nailed the cause. The modal stays mounted and hides itself, and the only setConfig on open sits behind the reconfigure branch, so a plain Add → close → Add keeps the whole previous form including pass and ssh_key. The name collision falling out of that (and the per-cluster logger being keyed on name) matches what you saw with the three pxve0 entries.
#787 hangs together with it, same root. Thanks for filing both with the repro steps and then sending PRs on top, that saves us a lot — we will go through 789/790 rather than writing our own version of it.
https://opencollective.com/pegaprox if you feel like it.
Marcus
Also fixed in 1.2.0 — the Add Cluster dialog resets on close, so it no longer hands you the previous cluster's name and credentials. Thanks for both reports on the same day, and for the PR.
— MK