DioxusLabs/dioxus

Unused `asset!` causes an error

Opened this issue · 0 comments

Problem

19:35:05 [dev] Hotreloading: /src/main.rs
19:35:05 [web] %cERROR%c ~/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/dioxus-core-0.6.1/src/hotreload_utils.rs:192%c Expected a string component property, because the type was &str. The CLI gave the hot reloading engine a type of None. This is probably caused by a bug in dioxus hot reloading. Please report this issue
const FAVICON: Asset = asset!("/assets/favicon.ico");
const MAIN_CSS: Asset = asset!("/assets/styling/main.css");
const TAILWIND_CSS: Asset = asset!("/assets/styling/tailwind.css");

fn main() {
    dioxus::launch(App);
}

#[component]
fn App() -> Element {
    rsx! {
        document::Link { rel: "icon", href: FAVICON }
        document::Link { rel: "stylesheet", href: TAILWIND_CSS }
        // document::Link { rel: "stylesheet", href: MAIN_CSS }
        Navbar {}
    }
}

I am not allowed to have defined assets and not use them.

Steps To Reproduce

Steps to reproduce the behavior:

  • add const asset
  • don't use it
  • serve the web

Expected behavior

No errors.

Screenshots

Environment:

  • Dioxus version: v0.6.1
  • Rust version: rustc 1.83.0-nightly (fb4aebddd 2024-09-30)
  • OS info: Pop!_OS 22.04
  • App platform: web + fullstack

Questionnaire

I'm interested in fixing this myself but don't know where to start.
I don't have time to fix this right now, but maybe later.