1
2
3
4
5
6
7
8
9
10
11
12
13
use dioxus_radio::prelude::use_radio;
use freya_native_core::prelude::NodeId;
use freya_renderer::devtools::NodeInfo;

use crate::state::DevtoolsChannel;

pub fn use_node_info(node_id: NodeId) -> Option<NodeInfo> {
    let radio = use_radio(DevtoolsChannel::UpdatedDOM);
    let state = radio.read();
    let nodes = state.devtools_receiver.borrow();

    nodes.iter().find(|node| node.id == node_id).cloned()
}