skeleton of use_server_future with reactivity

This commit is contained in:
Jonathan Kelley committed 2024-02-01 13:21:52 -08:00
1 parent b3ed337b6b
commit 0c71b95e82
11 files changed
+200 -193

No files matched your search

+2 -11
View File
@@ -1,4 +1,5 @@
use crate::write::*;
use crate::CopyValue;
use core::{self, fmt::Debug};
use dioxus_core::prelude::*;
use futures_channel::mpsc::UnboundedSender;
@@ -8,26 +9,16 @@ use parking_lot::RwLock;
use rustc_hash::FxHashMap;
use std::fmt::{self, Formatter};
use crate::CopyValue;
thread_local! {
pub(crate)static EFFECT_STACK: EffectStack = EffectStack::default();
}
#[derive(Default)]
pub(crate) struct EffectStack {
pub(crate) effects: RwLock<Vec<Effect>>,
pub(crate) effect_mapping: RwLock<FxHashMap<GenerationalBoxId, Effect>>,
}
impl Default for EffectStack {
fn default() -> Self {
Self {
effects: RwLock::new(Vec::new()),
effect_mapping: RwLock::new(FxHashMap::default()),
}
}
}
impl EffectStack {
pub(crate) fn current(&self) -> Option<Effect> {
self.effects.read().last().copied()