GigaDAO / wasi-sol

💳 A Solana Wallet adapter for WASM frameworks (WIP).
https://wasi-sol.netlify.app/
MIT License
16 stars 4 forks source link

Not working with Dioxus Fullstack #14

Open painedpineapple opened 1 month ago

painedpineapple commented 1 month ago

I'm uncertain to what is causing this but wanted to report it. When dioxus full stack is in use with wasi-sol the app will not run. This can be replicated just by updating the dioxus example in a couple of places and then running the dev server.

Cargo.toml

[package]
name = "wasi-sol-example"
version = "0.1.0"
edition = "2021"

[dependencies]
console_error_panic_hook = "0.1.7"
log = "0.4.21"
wasi-sol = { path = "../../", features = ["dio"] }
wasm-logger = "0.2.0"
dioxus = { version = "0.5", features = ["web", "fullstack" ] }

[features]
default = []
server = ["dioxus/axum"]
web = ["dioxus/web"]

main function in main.rs

fn main() {
    console_error_panic_hook::set_once();
    wasm_logger::init(wasm_logger::Config::default());

    #[cfg(feature = "server")]
    dioxus::fullstack::launch::launch(app, Vec::default(), dioxus::fullstack::Config::default());
}

Then run the following command

dx serve --platform fullstack --hot-reload

You'll get the following output along with no app running

Dioxus @ v0.5.4 [12:34:46]

    > Hot Reload Mode: RSX
    > Watching: [ src, assets, Cargo.toml, Dioxus.toml ]
    > Custom index.html: None
    > Serve index.html on 404: True

    > Build Features: [ server ]
    > Build Profile: Debug
    > Build took: 83138 millis

Listening on 127.0.0.1:8080
panicked at /Users/painedpineapple/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wasm-bindgen-0.2.92/src/lib.rs:1017:1:
function not implemented on non-wasm32 targets
panicked at /Users/painedpineapple/.cargo/registry/src/index.crates.io-6f17d22bba15001f/dioxus-fullstack-0.5.2/src/render.rs:97:60:
called `Result::unwrap()` on an `Err` value: RecvError(())
wiseaidev commented 1 month ago

Thanks for the experiments, @painedpineapple!

Currently, the crate only supports client-side rendering, meaning all components are rendered in the browser. Adding support for server-side rendering would be awesome for performance/seo reasons.

PRs are welcome as usual, so feel free to contribute if you'd like.