surrealdb / surrealist

Surrealist is the ultimate way to visually manage your SurrealDB database
https://surrealist.app/
MIT License
1.03k stars 73 forks source link

Surrealist app is unable to start if there is typo in the connection URL #273

Closed winksaville closed 1 month ago

winksaville commented 1 month ago

Describe the bug:

When trying to start surrealist with a bad connection setup, in my case a typo in the URL, it is unable to start and gets stuck showing the following:

image

If you press the [Restart Surrealist] button the app restarts but continues to display the same content.

To Reproduce:

Steps to reproduce the behavior:

  1. Edit .config/SurrealDB/Surrealist/config.json
  2. Change the "connections[activeConnection].connection.hostname" separator from ":" to "."; example: 127.0.0.1.12345
  3. Execute surrealist
  4. See error:

Message

"http://127.0.0.1.12345" cannot be parsed as a URL.

Stack trace

URL@[native code]
TC@tauri://localhost/assets/client-Bvt8X8zA.js:70:11256
TRt@tauri://localhost/assets/surrealist-DxWI0iWD.js:923:470
tl@tauri://localhost/assets/client-Bvt8X8zA.js:39:19520
x8@tauri://localhost/assets/client-Bvt8X8zA.js:41:43952
_8@tauri://localhost/assets/client-Bvt8X8zA.js:41:39716
$y@tauri://localhost/assets/client-Bvt8X8zA.js:41:39644
oo@tauri://localhost/assets/client-Bvt8X8zA.js:41:39497
O3@tauri://localhost/assets/client-Bvt8X8zA.js:41:35864
y8@tauri://localhost/assets/client-Bvt8X8zA.js:41:34815
R@tauri://localhost/assets/client-Bvt8X8zA.js:26:1560
D@tauri://localhost/assets/client-Bvt8X8zA.js:26:1925

Expected behavior:

Since the app cannot make a connection it should display connection edit dialog box with the contents of the bad connection. From their the user should be able to fix the bad connection, create a new connection or select another connection.

I would also suggest that surrealist be able to be run from the command line and the user be able to specify what config.json file to run, which activieConnection to use and if the mode should be "run" or "edit".

Environment:

Platform: Desktop
OS: Linux
Architecture: x86_64
WebView: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Safari/605.1.15
Version: 2.0.3
Flags: featureFlags: false, models_view: true, apidocs_view: true, themes: false, newsfeed: true
kearfy commented 1 month ago

Fixed in https://github.com/surrealdb/surrealist/commit/e723015b00b93f6ae89c0854b815dce5cb99bc1e

winksaville commented 1 month ago

The fix is definitely an improvement, but doesn't help if an invalid URL is introduced by manually editing or corruption of the config.json. It seems to me an invalid URL or other "simple" error in the config.json shouldn't make the app non-functional.