yukinarit / mapbox-gl-rs

Unofficial Rust/WASM binding for mapbox-gl-js
MIT License
39 stars 14 forks source link

Update the leptos example #63

Closed RmStorm closed 5 months ago

RmStorm commented 5 months ago

Without this snippet Leptos drops the map:

    // Make a signal that can store the map inside the reactive system..
    // The map has to _live_ for it to be able track its handlers and stuff!
    let map_store = create_rw_signal(None);
    ---
    map_store.set(Some(map));

Since the map stores all the handlers, stuff like adding closure to run on anything don't work.. since they get dropped right away with the map. This resolves those issues that potential users (like me) might encounter!