zulip/zulip-desktop

Sidebar bottom buttons (preferences, back, reload) don't work if a configured server is unresponsive

klardotsh opened this issue · 1 comments

Describe the bug

If a server is unreachable at the time the Zulip Desktop app is started, the server settings pull crashes with an unhandled exception and the button handlers for the back, reload, preferences, etc. buttons in the bottom left are never attached.

Running the AppImage from the terminal, I see these relevant logs:

(node:24810) electron: Failed to load URL: http://localhost:9991/ with error: ERR_CONNECTION_REFUSED
(Use `zulip --trace-warnings ...` to show where the warning was created)

Note: ^ --trace-warnings doesn't pass through with AppImage it seems

Error occurred in handler for 'get-server-settings': Error: net::ERR_CONNECTION_REFUSED
    at SimpleURLLoaderWrapper.<anonymous> (node:electron/js2c/browser_init:2:49386)
    at SimpleURLLoaderWrapper.emit (node:events:513:28)
    at SimpleURLLoaderWrapper.emit (node:domain:489:12)

To Reproduce

Configure Zulip Desktop to use a server which may not always exist, for example a local development server. $XDG_CONFIG_HOME/Zulip/config/domain.json might look something like:

{
    "domains": [
        {
            "icon": "/home/j/.config/Zulip/server-icons/820503988.png",
            "url": "https://chat.zulip.org",
            "alias": "Zulip Community"
        },
        {
            "icon": "/home/j/.config/Zulip/server-icons/3800001240",
            "url": "http://localhost:9991",
            "alias": "Zulip Dev"
        }
    ]
}

With the server offline, start the Zulip Desktop app, and note that you won't be able to access Preferences, or go back in click history.

If all servers listed are available at app start time (perhaps by removing the localhost:9991 entry from the JSON file manually), the app starts up completely as expected.

Expected behavior

Micro level: the back button works.

More generally: Application finishes assembling the UI even in the event of a flaky network or offline service, allowing access to Preferences (presumably even if entirely offline, like in airplane mode).

Desktop (please complete the following information):

  • Operating System: Void Linux x86_64, Wayland (sway)
  • Zulip Desktop Version: 5.9.4. Repros in 5.9.3 so this is not a regression introduced by the recent Electron v22 upgrade.

Additional context

Discovered while discussing binding mouse buttons to the back functionality, a separate issue with a related core confusion of "why can't I go back in ZD, and thus I use Firefox for all my Zulip-ing?" which uncovered this issue.

Zulip Desktop 5.9.5 fixes a bug where the app would freeze in this case. It should now display the network error page and otherwise continue working normally.