You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When trying to use fermi with a vec atom, the desktop app panics at runtime with error:
thread 'main' panicked at 'No atom root found in context. Did you forget place an AtomRoot component at the top of your app?', /Users/aimeri/.cargo/git/checkouts/dioxus-1e619ce595d3799d/cb7e4f3/packages/fermi/src/hooks/atom_root.rs:10:17
Steps To Reproduce
Here's a simple repro:
Cargo.toml
[package]
name = "fermi-atom-root-repro"version = "0.1.0"edition = "2021"# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
dioxus = {git = "https://github.com/dioxuslabs/dioxus.git"}
dioxus-desktop = {git = "https://github.com/dioxuslabs/dioxus.git"}
fermi = { git = "https://github.com/dioxuslabs/dioxus.git"}
main.rs
use dioxus::prelude::*;use dioxus_desktop::{Config,WindowBuilder};use fermi::*;fnmain(){
dioxus_desktop::launch_cfg(
app,Config::new().with_window(WindowBuilder::new().with_title("Dioxus")));}#[derive(Debug,Clone,Eq,Ord,PartialEq,PartialOrd)]pubstructRoom{pubid:u16,pubname:String,pubdescription:String,pubexits:Vec<String>,pubstash:Storage,pubroom_events:Vec<u16>,pubnarrative:u16,pubsubjects:Vec<u16>,}#[derive(Debug,Clone,Eq,Ord,PartialEq,PartialOrd,Default)]pubstructStorage{pubitems:Vec<String>,pubitem_ids:Vec<u16>,}staticROOMS:AtomRef<Vec<Option<Room>>> = |_| vec![None::<Room>;81];pubfnapp(cx:Scope) -> Element{let rooms = use_atom_ref(cx,ROOMS);
cx.render(rsx!(
div {
rooms.read().iter().map(|f| rsx!{ifletSome(_) = f {
rsx!{
div {"hello"}}}})}))}
NOTE: The fermi.rs example in the main dioxus repository has the exact same behavior, so it also works as a repro for this issue.
Expected behavior
The app should run, and initially I should see nothing on the screen, but if I populated the rooms atom with rooms, I'd see a series of divs with hello on the screen.
Environment:
Dioxus version: master
Rust version: nightly
OS info: MacOS Ventura
App platform: desktop
The text was updated successfully, but these errors were encountered:
Problem
When trying to use fermi with a vec atom, the desktop app panics at runtime with error:
Steps To Reproduce
Here's a simple repro:
Cargo.toml
main.rs
NOTE: The
fermi.rs
example in the main dioxus repository has the exact same behavior, so it also works as a repro for this issue.Expected behavior
The app should run, and initially I should see nothing on the screen, but if I populated the rooms atom with rooms, I'd see a series of divs with hello on the screen.
Environment:
master
nightly
desktop
The text was updated successfully, but these errors were encountered: