Skip to content
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

Manganis failing to parse ? #25

Open
LouisTruch opened this issue Apr 18, 2024 · 0 comments
Open

Manganis failing to parse ? #25

LouisTruch opened this issue Apr 18, 2024 · 0 comments

Comments

@LouisTruch
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant