-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Bug Description
The refresh button in the ServerBrowser class is not working correctly after recent code updates. When the button is pressed, it doesn't properly refresh the server list as it did in the previous version.
What Changed
Comparing the old and new code, several critical changes were made that affected the refresh functionality:
- Missing Button State Reset: In the new code, we fail to reset
is_refreshingto false andrefresh_button.disabledto false after refreshing. The previous code had these lines in_on_refresh_pressed():
is_refreshing = true
refresh_button.disabled = true
await _refresh_server_list()
is_refreshing = false # This line is missing in new code
refresh_button.disabled = false # This line is missing in new code- Removed Authentication Logic: The authentication check before refreshing was removed. The old code had:
# Re-authenticate if needed
if dns_manager.has_method("auth_and_sync_if_needed") and (dns_manager.session == null or dns_manager.session.is_expired()):
var reok = await dns_manager.auth_and_sync_if_needed()
if not reok:
push_error("Authentication failed. Press Host to log in.")
return- Removed Initial and Auto-Refresh Timers: The new code removed several auto-refresh related components:
- Initial refresh timer setup and logic
- The
_try_refresh_with_auth()method - The auto-refresh state management methods
Steps to Fix
- Restore the button state reset after refresh:
func _on_refresh_pressed() -> void:
if is_refreshing:
return
# Re-authenticate if needed
if dns_manager.has_method("auth_and_sync_if_needed") and (dns_manager.session == null or dns_manager.session.is_expired()):
var reok = await dns_manager.auth_and_sync_if_needed()
if not reok:
push_error("Authentication failed. Press Host to log in.")
return
is_refreshing = true
refresh_button.disabled = true
await _refresh_server_list()
is_refreshing = false # Add this line back
refresh_button.disabled = false # Add this line back- Consider restoring the authentication logic in a separate method to ensure proper session handling before attempting to fetch server data.
Expected Behavior
After the fix, the refresh button should:
- Disable itself while refreshing to prevent multiple clicks
- Re-enable itself after refresh is complete
- Properly update the server list with fresh data
Additional Notes
Other features that were removed and may be worth restoring:
- Auto-refresh functionality with configurable interval
- Initial refresh after a short delay
- Proper authentication and session management
These were likely important features that improved the user experience by keeping the server list up-to-date without manual refresh.
Metadata
Metadata
Assignees
Labels
No labels