-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Introduce explicit internal datastructures modeling dom state #2330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
5f6e8ed
b302a88
994a6db
38fb925
355e328
35d7c2e
d9bd30a
c843a2b
f576c36
751fed2
749c078
cac9066
c357045
a95bf13
3563f39
c1a0b49
0ae4063
25a760c
8704881
02800d3
f28ebfe
a2a6b92
1b446a6
5339f49
e96bcec
3dbc932
9ee4561
b0a16e0
eca11f4
06e736b
c713027
5010f34
02c7dd6
c1a7ba9
0678829
bea0708
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,16 @@ | ||
| //! This module contains the `App` struct, which is used to bootstrap | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How is this module related to
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm fine with keeping it here. If we support any platform other than web, then it'll have to but that's for the future. |
||
| //! a component in an isolated scope. | ||
| //! [AppHandle] contains the state Yew keeps to bootstrap a component in an isolated scope. | ||
|
|
||
| use std::ops::Deref; | ||
|
|
||
| use crate::html::{BaseComponent, NodeRef, Scope, Scoped}; | ||
| use std::rc::Rc; | ||
| use super::{ComponentRenderState, Scoped}; | ||
| use crate::html::{BaseComponent, Scope}; | ||
| use crate::NodeRef; | ||
| use std::{ops::Deref, rc::Rc}; | ||
| use web_sys::Element; | ||
|
|
||
| /// An instance of an application. | ||
| #[derive(Debug)] | ||
| pub struct AppHandle<COMP: BaseComponent> { | ||
| /// `Scope` holder | ||
| pub(crate) scope: Scope<COMP>, | ||
| scope: Scope<COMP>, | ||
| } | ||
|
|
||
| impl<COMP> AppHandle<COMP> | ||
|
|
@@ -27,14 +26,17 @@ where | |
| let app = Self { | ||
| scope: Scope::new(None), | ||
| }; | ||
| let node_ref = NodeRef::default(); | ||
| let initial_render_state = | ||
| ComponentRenderState::new(element, NodeRef::default(), &node_ref); | ||
| app.scope | ||
| .mount_in_place(element, NodeRef::default(), NodeRef::default(), props); | ||
| .mount_in_place(initial_render_state, node_ref, props); | ||
|
|
||
| app | ||
| } | ||
|
|
||
| /// Schedule the app for destruction | ||
| pub fn destroy(mut self) { | ||
| pub fn destroy(self) { | ||
| self.scope.destroy(false) | ||
| } | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change should fix #2403 . As I understand it, tasks are inherited and run for all workspace members anyway, unless overwritten.