Skip to content

Commit

Permalink
fix(core): 🐛 invalid splitted state after origin state modified
Browse files Browse the repository at this point in the history
  • Loading branch information
M-Adoo committed Nov 13, 2023
1 parent f520bb3 commit 640d9cd
Show file tree
Hide file tree
Showing 6 changed files with 437 additions and 343 deletions.
12 changes: 12 additions & 0 deletions core/src/render_helper.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use crate::prelude::*;
use ribir_algo::Sc;
use std::{cell::RefCell, ops::Deref};

pub(crate) trait RenderTarget {
type Target: Render + ?Sized;
Expand Down Expand Up @@ -50,3 +52,13 @@ impl<R: RenderTarget + Query> Render for RenderProxy<R> {
impl<R: RenderTarget + Query> Query for RenderProxy<R> {
crate::widget::impl_proxy_query!(0);
}

impl<R: Render> RenderTarget for RefCell<R> {
type Target = R;
fn proxy<V>(&self, f: impl FnOnce(&Self::Target) -> V) -> V { f(&*self.borrow()) }
}

impl<R: RenderTarget> RenderTarget for Sc<R> {
type Target = R::Target;
fn proxy<V>(&self, f: impl FnOnce(&Self::Target) -> V) -> V { self.deref().proxy(f) }
}
Loading

0 comments on commit 640d9cd

Please sign in to comment.