[Bug] Config modal can get stuck in a reload loop because useEffect depends on the whole vm object
Hey there! 👋 Thanks for taking the time to report this bug — we appreciate it!
Please keep in mind: PegaProx is developed and maintained entirely by volunteers in our free time. We do our best, but we can't work magic 🪄 — please be patient, we'll get to your issue as soon as we can.
Want to help keep PegaProx alive?
- ⭐ Star the project — it's free and helps a lot!
- 💖 Become a Sponsor — helps us dedicate more time to development
- 🤝 Contributing code or docs is always welcome too!
Describe the bug
The configuration modal for an LXC container can remain stuck indefinitely on the loading spinner.
The modal itself opens correctly and displays the container name, VMID, node, status and configuration tabs, but the configuration content never appears.
The issue was traced to the main useEffect() in ConfigModal (web/src/vm_config.js), which depends on the complete vm object:
}, [vm, clusterId]);
If the parent component creates a new vm object during rendering, React treats it as a changed dependency even though it still represents the same VM/container.
This causes the effect to execute again, and fetchConfig() sets:
setLoading(true);
The modal can therefore repeatedly return to the loading state.
Changing the dependency array to stable VM identity properties fixes the issue:
}, [vm.vmid, vm.node, vm.type, clusterId]);
After this change, the LXC configuration modal loads normally.
The backend LXC handling itself works correctly. PegaProx correctly selects:
/api2/json/nodes/<node>/lxc/<vmid>/config
and the LXC branch in _parse_vm_config() correctly handles the returned configuration.
There is also another useEffect() in the same component using:
[activeTab, vm, clusterId]
for QEMU passthrough loading. It may be worth changing this dependency to stable VM identity fields as well for consistency.
Steps to Reproduce
- Open an LXC container in PegaProx.
- Open the Configure modal.
- The modal header and tabs are displayed correctly, but the main content area remains on the loading spinner indefinitely.
Expected behavior
The configuration modal should load the container configuration normally.
The data-loading effect should only run again when the actual VM/container identity (vmid, node, type) or cluster changes.
A parent component re-render or recreation of the vm JavaScript object should not restart the configuration loading cycle.
Environment
- PegaProx Version: Current development branch
- Installation Method: Docker (local build from git clone)
- OS: Debian
- Browser: Chromium-based browser
- Behind Reverse Proxy? No
- UI? Corporate
Logs
No relevant backend errors were generated while the modal was stuck on the loading spinner.
PegaProx remained connected to the Proxmox cluster and the LXC configuration endpoint was valid.
Relevant backend logic correctly selects the LXC endpoint:
if vm_type == 'qemu':
url = f"https://{self.host}:{self.api_port}/api2/json/nodes/{node}/qemu/{vmid}/config"
else:
url = f"https://{self.host}:{self.api_port}/api2/json/nodes/{node}/lxc/{vmid}/config"
The API helper also has a configured timeout:
def _api_get(self, url, **kwargs):
kwargs.setdefault('timeout', self.api_timeout)
The issue was resolved on the frontend by replacing:
}, [vm, clusterId]);
with:
}, [vm.vmid, vm.node, vm.type, clusterId]);
Screenshots
Screenshot attached showing the LXC configuration modal in Corporate UI with the header and tabs rendered correctly while the main content area remains stuck on the loading spinner.
After applying the dependency change described above, the same modal loads the configuration correctly.
Checklist
- [x] I have searched existing issues to make sure this is not a duplicate
- [x] I am using the latest version of PegaProx
Update: Further testing shows that the issue is intermittent. The modal can load correctly from both the Configuration tab and the Configure button. Both entry points call the same onOpenConfig(vm) handler. I also verified that localization changes in translations.js alone do not reproduce the problem. The earlier dependency change from: [vm, clusterId]
to:
[vm.vmid, vm.node, vm.type, clusterId] is still present. At this point the exact trigger is not yet confirmed. I will continue testing and capture the /config request and loading-state behavior when the spinner reproduces again.
Nice catch — and thanks for tracing it all the way to the dependency array, that made it a two-line fix.
You're exactly right: ConfigModal's fetch effect (and the qemu passthrough one) keyed on the whole vm object, so a parent re-render that rebuilt vm re-fired the fetches and bounced the modal back to setLoading(true) — most visible on LXC where you noticed it. Both effects now key on stable VM identity (vm.vmid / vm.node / vm.type + clusterId).
Fixed on Testing (bc852c2), ships in the next release. I left the SSE live-update listener effect on [vm, …] on purpose — it only re-subscribes an event listener (no fetch, no loading state), so it doesn't cause the loop.
Thanks again for the clean report. Closing as fixed.