Skip to content

Manganis failing to parse ?  #25

@LouisTruch

Description

@LouisTruch

I got this weird bug when working on a Component which has nothing to do with manganis.

thread 'main' panicked at /home/ltruchel/.cargo/registry/src/index.crates.io-6f17d22bba15001f/manganis-cli-support-0.2.4/src/file.rs:176:75: called Result::unwrap() on an Err value: Error { kind: UnexpectedToken(CurlyBracketBlock), loc: Some(ErrorLocation { filename: "", line: 1162, column: 11 }) } note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

Steps To Reproduce

I don't really have a way to reproduce, the bug seems to be gone right now but I was editing this

#[props_component(id, class, children)]
pub fn AccordionContent() -> Element {
let class = tw_merge!(props.base(), props.class);

let mut elem_height = use_signal(|| "".to_string());

let sig_id = use_string_to_signal_string(props.id.clone());

let onmounted = move |_| async move {
    match use_element_scroll_height(&sig_id()) {
        Ok(height) => {
            elem_height.set(format!("{}px", height));
        }
        Err(e) => {
            log::error!("Failed to get element height: {:?}", e);
        }
    }
};

let accordion_state = consume_context::<Signal<AccordionState>>();

let (final_height, state) = match accordion_state.read().is_active(&sig_id()) {
    true => (elem_height(), false),
    false => ("0".to_string(), true),
};

rsx!(
    div {
        "data-state": state,
        id: props.id,
        class: class,
        height: final_height,
        onmounted: onmounted,
        {props.children}
    }
)}

(the proc macro expand to a basic Props struct and fn using this said Props, I have used it about 30 times and had no problem with it)
when I saved dx serve recompiled the project but did not success and gave me the error above.
This is the only line about manganis I have in my project const _STYLE: &str = manganis::mg!(file("public/tailwind.css"));
When it occured, I tried bumping manganis to 0.2.2 but it did the same thing.

Expected behavior

To compile

Environment:
dioxus = { git = "https://github.com/DioxusLabs/dioxus", rev = "c9ab09b3480ba2ad3b77d16c5e86382a62258194", features = ["web", "router"] }
dioxus-logger = "0.4.1"
tailwind_fuse = { version = "0.2.0", features = ["variant"] }
manganis = "0.2.1"
dioxus-free-icons = { version = "0.8", features = ["font-awesome-brands", "font-awesome-regular","feather"] }
web-sys = {version = "0.3.69", features = ["Element", "Window", "CssStyleDeclaration", "ResizeObserver"]}

[patch.crates-io]
dioxus = { git = "https://github.com/DioxusLabs/dioxus", rev = "c9ab09b3480ba2ad3b77d16c5e86382a62258194" }

OS Ubuntu 23.10

Dioxus targeting Web only

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions