Filter unreachable servers from selector (newdesign UI)#769
Filter unreachable servers from selector (newdesign UI)#769
Conversation
Review Summary by QodoFilter unreachable servers from selector and fix dropdown state management
WalkthroughsDescription• Filter unreachable servers from dropdown selector • Run server reachability checks before populating UI • Reset dropdown state on each population to prevent stale data • Prevent duplicate event listener registration on dropdown Diagramflowchart LR
A["Fetch server list"] --> B["Single server?"]
B -->|Yes| C["Show directly"]
B -->|No| D["Run reachability checks"]
D --> E["Filter dead servers"]
E --> F["Reset dropdown state"]
F --> G["Populate dropdown UI"]
G --> H["Register event listeners once"]
File Changes1. frontend/javascript/index.js
|
Code Review by QodoSorry, something went wrongWe weren't able to complete the code review on our side. Please try againⓘ The new review experience is currently in Beta. Learn more |
There was a problem hiding this comment.
Pull request overview
This PR aims to improve the “newdesign” frontend server selector by hiding unreachable (“dead”) speedtest servers from the dropdown list, based on the ping reachability results produced by the built-in Speedtest.selectServer logic.
Changes:
- Defer populating the server dropdown until after
selectServerhas pinged servers, then filter out servers withpingT === -1. - Add UI reset logic in
populateDropdownto support re-rendering and avoid duplicate event handler registration.
Comments suppressed due to low confidence (1)
frontend/javascript/index.js:201
- In the
servers.length === 1path,populateDropdownnow removes the.activeclass (line 193) and then returns without re-adding it. Since.server-selectorisdisplay: noneunless.activeis present, this will hide the server selector entirely when reachability filtering leaves exactly one server alive. Consider always adding.activebefore returning (or adding it specifically in the single-server branch) so the chosen server remains visible.
// Reset previous state (populateDropdown can be called multiple times)
serverSelector.classList.remove("single-server");
serverSelector.classList.remove("active");
serverList.classList.remove("active");
serverList.innerHTML = "";
// If we have only a single server, just show it
if (servers.length === 1) {
serverSelector.classList.add("single-server");
selectServer(servers[0]);
return;
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Updates the newdesign UI’s server selector to avoid showing unreachable speedtest servers by leveraging LibreSpeed’s built-in server ping/selection, and improves dropdown re-render behavior.
Changes:
- Delay dropdown population until after
Speedtest.selectServer()completes, then filter servers based on reachability (pingT). - Keep a fallback to show the full list when no servers are reachable.
- Reset dropdown DOM/class state on each render and ensure open/close handlers are only attached once.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
dont show dead servers