-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VWeb UI stops unexpectedly #77
Comments
We may need more details, please give us the code you are using, and logs also will be useful. |
Kindly find below the code I have. Thank you.
|
@ttytm what do you think? |
@AlbertShown Upon investigation, imho, the problem relates less to using webui, but more to using the vega-embed CDN script. For example, the same problem occurs with the original webui library. webui C code#include "webui.h"
int main() {
const char *html = "<!DOCTYPE html>"
"<html>"
" <head>"
" <script src=\"https://cdn.jsdelivr.net/npm/[email protected]\"></script>"
" <script src=\"https://cdn.jsdelivr.net/npm/[email protected]\"></script>"
" <script src=\"https://cdn.jsdelivr.net/npm/[email protected]\"></script>"
" <script src=\"webui.js\"></script>"
" </head>"
" <body>"
" <a href=\"https://www.w3schools.com\" target=\"_blank\">Visit W3Schools.com!</a>"
" <p>My First plot</p>"
" <br>"
" <div id=\"vis\"></div>"
" <script>"
" let FirstPlot = {"
" $schema: \"https://vega.github.io/schema/vega-lite/v5.json\","
" data: {"
" values: ["
" {Languages: \"Python\", Values: 2},"
" {Languages: \"Python\", Values: 3},"
" {Languages: \"Python\", Values: 2},"
" {Languages: \"JavaScript\", Values: 4},"
" {Languages: \"Perl\", Values: 2} ]"
" },"
" mark: \"bar\","
" encoding: {"
" x: {field: \"Values\", type: \"quantitative\"},"
" y: {field: \"Languages\", type: \"ordinal\"}"
""
" }"
" };"
" vegaEmbed(\"#vis\", FirstPlot);"
" </script>"
"</body>"
"</html>";
size_t w = webui_new_window();
webui_show(w, html);
webui_wait();
webui_clean();
return 0;
} The error could be handled more gracefully though instead of crashing. For example, with webview, the 'Save as SVG' menu item doesn't work, but it doesn't crash. webview V codeimport ttytm.webview as ui
const html = '<!DOCTYPE html>
<html lang="en">
<head>
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
</head>
<body>
<a href="https://www.w3schools.com" target="_blank">Visit W3Schools.com!</a>
<p>My First plot</p>
<br>
<div id="vis"></div>
<script>
let FirstPlot = {
\$schema: "https://vega.github.io/schema/vega-lite/v5.json",
data: {
values: [
{Languages: "Python", Values: 2},
{Languages: "Python", Values: 3},
{Languages: "Python", Values: 2},
{Languages: "JavaScript", Values: 4},
{Languages: "Perl", Values: 2} ]
},
mark: "bar",
encoding: {
x: {field: "Values", type: "quantitative"},
y: {field: "Languages", type: "ordinal"}
}
};
vegaEmbed("#vis", FirstPlot);
</script>
</body>
</html>'
w := ui.create(debug: true)
w.set_size(600, 400, .@none)
w.set_html(html)
w.run() To my current knowledge it's hard to tell the real source of the issue. Personally, I won't dig into it. Something you could try @sainthasras is using the vega-embed not as cdn script and debug there. |
I will try as suggested. Thank you....very grateful. |
Realizing that the plot SVGs are saved in my Downloads directory after all, I see that with V webview the files are saved when clicking So for webui (unrelated to its V wrapper) we would need to investigate why webui is crashing when there there is this call to the download. |
Thank you @ttytm for your test, what you explained is already enough to point to the right direction. In my side, I did a quick test using the debug version of webui, seems the lib does not crash, but simply disconnect after a Blob re-direction (URL navigation) as
|
Web Browser Logs:
|
Oh yes, crash is the wrong term here. Do you have an opinion on whether there should be a handling other than closing a connection when navigating to a URL that doesn't embed |
It really feels good when one realizes their problems are being given all the necessary attention they require. I must also say, crash is the wrong term (maybe because of the way I presented the problem). The application does not crash, just that it disconnects. Thank you once again for the effort you are putting in to resolve this. |
Normally, Another thing, is that it's hard to accurately distinguish between a In the other hand, I see some potential solutions:
|
About |
I am on a Windows operating system. I have tried using vegalite.js in my application. Everything works fine, until I click Save as SVG menu item near the plots. VWeb UI will then close, and the application breaks.
The text was updated successfully, but these errors were encountered: