contd. #1161405149080731760 message
Since we do not yet have a function like this:
fn break_option(s: Signal<Option<T>>) -> ReadOnlySignal<Option<ReadOnlySignal<T>>
I tried what I can to come up with a similar architecture to decouple the "loading" widget from the actual data rendering widget:
https://github.com/srid/dioxus-desktop-template/pull/8/files
The loader widget looks about right,
fn Loader(cx: Scope, loading: ReadOnlySignal<bool>) -> Element {
But the data rendering widget is not great, because it takes an Option when it shouldn't have to:
fn ViewMemoryStats(cx: Scope, stats: ReadOnlySignal<Option<memory_stats::MemoryStats>>) -> Element {
In absence of a function like break_option, I'm left with the only option of using use_selector to create these separate signals:
let value: ReadOnlySignal<Option<memory_stats::MemoryStats>> =
use_selector(cx, move || *state.system.read());
let loading: ReadOnlySignal<bool> = use_selector(cx, move || state.system.read().is_none());
Is there anything I can do to help this situation?
cc @lament schooner