wip: memoize dom in the prescence of identical components
This commit is contained in:
1 parent
7cf15ee4e8
commit
cb2782b4bb
27 files changed
+474
-219
No files matched your search
@@ -12,8 +12,8 @@ pub struct UseStateOwned<T: 'static> {
|
||||
}
|
||||
|
||||
impl<T> UseStateOwned<T> {
|
||||
pub fn get(&self) -> Ref<T> {
|
||||
Ref::map(self.wip.borrow(), |x| x.as_ref().unwrap())
|
||||
pub fn get(&self) -> Ref<Option<T>> {
|
||||
self.wip.borrow()
|
||||
}
|
||||
|
||||
pub fn set(&self, new_val: T) {
|
||||
@@ -21,8 +21,9 @@ impl<T> UseStateOwned<T> {
|
||||
(self.update_callback)();
|
||||
}
|
||||
|
||||
pub fn modify(&self) -> RefMut<T> {
|
||||
RefMut::map(self.wip.borrow_mut(), |x| x.as_mut().unwrap())
|
||||
pub fn modify(&self) -> RefMut<Option<T>> {
|
||||
(self.update_callback)();
|
||||
self.wip.borrow_mut()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user