Skip to content

Commit

Permalink
fix(core): 🐛 Fix TextStyle cause providers mismatched
Browse files Browse the repository at this point in the history
  • Loading branch information
wjian23 authored and rchangelog[bot] committed Dec 18, 2024
1 parent d5eec2b commit 13d8886
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 16 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ Please only add new entries below the [Unreleased](#unreleased---releasedate) he

- **core**: fix mismatch of providers. (#669 @wjian23)
- **core**: Added DeclarerWithSubscription to let Widget `Expanded` accept pipe value. (#669 @wjian23)
- **core**: fix set opacity zero no work to it's children. (#pr @wjian23)
- **core**: Fix setting opacity to zero not applying to child elements (#671 @wjian23)
- **core**: Fix TextStyle cause providers mismatched (#671 @wjian23)

## [0.4.0-alpha.18] - 2024-12-11

Expand Down
13 changes: 4 additions & 9 deletions core/src/builtin_widgets/class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,15 +160,10 @@ impl<'c> ComposeChild<'c> for OverrideClass {
let cls_override = this.try_into_value().unwrap_or_else(|_| {
panic!("Attempting to use `OverrideClass` as a reader or writer is not allowed.")
});
let f = move || {
BuildCtx::get_mut()
.current_providers
.push(Box::new(Queryable(cls_override)));
let id = child.build();
BuildCtx::get_mut().current_providers.pop();
Widget::from_id(id)
};
f.into_widget()

Provider::new(Box::new(Queryable(cls_override)))
.with_child(fn_widget! { child })
.into_widget()
}
}

Expand Down
9 changes: 3 additions & 6 deletions core/src/builtin_widgets/text_style.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,9 @@ impl<'c> ComposeChild<'c> for TextStyleWidget {
}
};

let ctx = BuildCtx::get_mut();
ctx.current_providers.push(provider);
child.into_widget().on_build(|id| {
let provider = ctx.current_providers.pop().unwrap();
id.attach_data(provider, ctx.tree_mut());
})
Provider::new(provider)
.with_child(fn_widget! { child })
.into_widget()
}
}

Expand Down

0 comments on commit 13d8886

Please sign in to comment.