#Splash screen issue

17 messages ยท Page 1 of 1 (latest)

low turtle
#

I've been trying the splash screen feature and for some reason there might be a bug or eathier do something wrong
And I recorded some video
Idk why but insteatd of showing a circle loader animation it shows the contents of the main page even though I picked the loader page in tauri.conf.json

code

tauri.conf.json

"windows": 
    [
      {
        "fullscreen": false,
        "resizable": true,
        "title": "green-house-controler",
        "width": 800,
        "height": 600,
        "visible": false
      },
      {
        "width": 400,
        "height": 200,
        "decorations": false,
        "url": "../src/splashLoad.html",
        "label": "loading"
      }
    ]

main.rs

#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
use tauri::Manager;

fn main() {
    tauri::Builder::default()
      .setup(|app| {
        let splashscreen_window = app.get_window("loading").unwrap();
        let main_window = app.get_window("main").unwrap();
        // we perform the initialization code on a new task so the app doesn't freeze
        tauri::async_runtime::spawn(async move {
          // initialize your app here instead of sleeping :)
          println!("Initializing...");
          std::thread::sleep(std::time::Duration::from_secs(2));
          println!("Done initializing.");
  
          // After it's done, close the splashscreen and display the main window
          splashscreen_window.close().unwrap();
          main_window.show().unwrap();
        });
        Ok(())
      })
      .run(tauri::generate_context!())
      .expect("failed to run app");
  }

and the loader page has a svg animated circle loader

#

Splash screen issue

thorny crater
#

Wild guess but you didn't add the html to your actual dev server/frontend, you added it as a file? Because the window that gets opened will just navigate to e.g. http://localhost:3000/splashLoad.html, so you need to make sure it actually gets served there

#

The reason it shows the main html instead I take it is because it falls back to showing that

low turtle
thorny crater
#

The config is called url because that's what it is, a URL, not a path

low turtle
thorny crater
#

Which frontend framework are you using?

#

"the dev server" is the server your frontend framwork is using. Unless you're using vanilla js and are just using a directory directly I suppose

thorny crater
#

If you're just using vanilla js and like ../dist to get your frontend even in dev mode, then the url should just be /splashLoad

#

Can people please stop using vanilla js ๐Ÿ˜‚ I keep telling people, you're just ending up developing your own custom framework from the ground up, we already have more frameworks than we need, stop reinventing the wheel ๐Ÿ˜‚

But yea, url isn't a path, it's a URL, set it to /splashLoad

#

(maybe /splashLoad.html)

low turtle
low turtle