Comments (9)
Hi, Can you please add the browser's DevTools logs or a screenshot?
from webui.
Thank you for the quick reply.
Index.html loads but is blank:
If I right-click and inspect the JS console, I see:
And here is index.html:
(NOTE: I have to put the webui.js
script below the SvelteKit starter script; otherwise, it gets into an infinite loop, crashing, Kit restarting, repeat.)
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<link rel="icon" href="/favicon.png" />
<link rel="modulepreload" href="/_app/immutable/entry/start.mFb7rvTb.js">
<link rel="modulepreload" href="/_app/immutable/chunks/entry.Bd4ck04i.js">
<link rel="modulepreload" href="/_app/immutable/chunks/scheduler.Vg6e9bTg.js">
<link rel="modulepreload" href="/_app/immutable/chunks/index.DtEDIqaG.js">
<link rel="modulepreload" href="/_app/immutable/chunks/control.CYgJF_JY.js">
<link rel="modulepreload" href="/_app/immutable/entry/app.iE8pe31a.js">
<link rel="modulepreload" href="/_app/immutable/chunks/preload-helper.BQ24v_F8.js">
<link rel="modulepreload" href="/_app/immutable/chunks/index.kVFNCZ3-.js">
</head>
<body data-sveltekit-preload-data="hover"; class="overflow-hidden">
<div style="display: contents;">
<script>
{
__sveltekit_1pkutvc = {
base: ""
};
const element = document.currentScript.parentElement;
Promise.all([
import("/_app/immutable/entry/start.mFb7rvTb.js"),
import("/_app/immutable/entry/app.iE8pe31a.js")
]).then(([kit, app]) => {
// console.log("starting...")
kit.start(app, element);
// console.log("started")
});
}
</script>
<script src="webui.js"></script>
</div>
</body>
</html>
from webui.
WAIT -- I think I found the problem -- not a webui thing, so don't waste any more of your time.
I switched to Windows dev (from WSL Ubuntu) for Zig, and my Windows CouchDb settings are I think the problem. I'm going down that route and will report back (and probably close this).
from webui.
Yes, that's what I was about to write, your server at 5984
should allow Access-Control-Allow-Origin from *
.
from webui.
Yes, I had not copied all settings correctly, so the CORS issue is solved.
However, the infinite loop (crash / reload) described above is still happening, regardless of where I place the webui.js script (See "NOTE", above).
My app starts to load (screenshot):
...but then it seems to be looking for index.html again, cannot find it, crashes, and sveltekit reloads.
Here's the console (pink is crashing, all the white logs are successful API calls; this repeats in a loop):
from webui.
If you want to use a custom web server with WebUI, you can then look at this C example on how to do that.
The example is using a Python web server, and using WebUI to show a window, and track the click events using webui.js
.
https://github.com/webui-dev/webui/blob/main/examples/C/custom_web_server/main.c
from webui.
Thanks, but no I don't need to write a server, it's just a SvelteKit SPA, with only client-side code. (SvelteKit can do server side, and is probably used mostly for that, but it also does SPAs by turning off all server-side stuff.)
The SPA makes many fetch calls to APIs that are separate apps.
I have a suspicion about what's happening, and that the problem is due to SvelteKit's client-side router or other code that SvelteKit generates. (SvelteKit does a ton behind the scenes, which is why it's so easy to write apps. But this ton of stuff is all compiled and mostly impenetrable by me.)
Anyway, what I think is happening:
- Something is happening to cause an error, during the initial load
- SvelteKit handles errors by reloading or re-routing
- WebUI is also responding to this re-routing, and tries to load index.html again...
- which triggers the error; goto (1)
I'll figure it out and, if it's of interest to the WebUI community I'll post back.
Closing this for now.
from webui.
Yes, I'm interested in learning more about this issue. We can improve WebUI or add a new option to make it more flexible to handle this kind of situation. When you have free time. Thank you.
from webui.
It seems to be a fundamental conflict with how SvelteKit works. I created a test project that has the same problem. The project is linked to in the new issue I opened: #392
from webui.
Related Issues (20)
- Fix All Core Bugs
- Build ARM CI with TLS HOT 1
- Update Documentation HOT 2
- auto update HOT 3
- Update Wrappers to 2.5.0.Beta.2 HOT 4
- feat: get all available browsers? HOT 2
- Accessibility Request: High Contrast Management HOT 3
- Idea: Development scaffolding similar to front-end HOT 5
- Perhaps the web UI could take inspiration from Blazor HOT 6
- Examples build on ARM for Windows issue HOT 2
- Is webui.js needed when webui_show() is for type WEBUI_SHOW_URL? HOT 2
- example bug, segment fault HOT 1
- webui_wait() returns when device goes to sleep. HOT 3
- Is it possible to embed web resources? HOT 3
- Using zig cc HOT 7
- Strange Behavior HOT 11
- Latest changes makes examples crash on macos HOT 5
- Segfault on dynamically linked library when built with `make WEBUI_USE_TLS=1` HOT 6
- Translating WebUI website HOT 1
- Issues with wait/close HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from webui.