Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .github/workflows/main-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jobs:
cargo clippy --features=ssr -- --deny=warnings
cargo clippy --features=csr -- --deny=warnings
cargo clippy --features=hydration -- --deny=warnings
cargo clippy --features=test_runner -- --deny=warnings
cargo clippy --all-features --all-targets -- --deny=warnings
working-directory: packages/yew

Expand Down Expand Up @@ -64,6 +65,7 @@ jobs:
cargo clippy --release --features=ssr -- --deny=warnings
cargo clippy --release --features=csr -- --deny=warnings
cargo clippy --release --features=hydration -- --deny=warnings
cargo clippy --release --features=test_runner -- --deny=warnings
cargo clippy --release --all-features --all-targets -- --deny=warnings
working-directory: packages/yew

Expand Down Expand Up @@ -159,8 +161,8 @@ jobs:
- name: Run tests - yew
run: |
cd packages/yew
CHROMEDRIVER=$(which chromedriver) cargo test --features csr,hydration,ssr --target wasm32-unknown-unknown
GECKODRIVER=$(which geckodriver) cargo test --features csr,hydration,ssr --target wasm32-unknown-unknown
CHROMEDRIVER=$(which chromedriver) cargo test --features test_runner,hydration,ssr --target wasm32-unknown-unknown
GECKODRIVER=$(which geckodriver) cargo test --features test_runner,hydration,ssr --target wasm32-unknown-unknown

- name: Run tests - yew-router
run: |
Expand Down Expand Up @@ -202,7 +204,7 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: test
args: -p yew --features "csr,ssr,hydration,tokio"
args: -p yew --all-features

test-lints:
name: Test lints on nightly
Expand Down
4 changes: 3 additions & 1 deletion packages/yew/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,10 @@ wasm-bindgen-futures = "0.4"
tokio = { version = "1.15.0", features = ["rt"], optional = true }

[dev-dependencies]
wasm-bindgen-test = "0.3"
futures = { version = "0.3" }
gloo = { version = "0.7", features = ["futures"] }
gloo-net = { version = "0.2", features = ["http"] }
wasm-bindgen-test = "0.3"
wasm-bindgen-futures = "0.4"
rustversion = "1"
trybuild = "1"
Expand All @@ -92,6 +93,7 @@ features = [
ssr = ["futures", "html-escape"] # dep:html-escape
csr = []
hydration = ["csr"]
test_runner = ["csr"]
default = []

[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
Expand Down
25 changes: 14 additions & 11 deletions packages/yew/src/app_handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ use std::rc::Rc;

use web_sys::Element;

use crate::dom_bundle::BSubtree;
use crate::dom_bundle::{BSubtree, Bundle};
use crate::html::{BaseComponent, NodeRef, Scope, Scoped};
use crate::virtual_dom::VChild;

/// An instance of an application.
#[cfg_attr(documenting, doc(cfg(feature = "csr")))]
Expand All @@ -26,19 +27,21 @@ where
/// will render the model to a virtual DOM tree.
pub(crate) fn mount_with_props(host: Element, props: Rc<COMP::Properties>) -> Self {
clear_element(&host);
let app = Self {
scope: Scope::new(None),
};
let mut bundle = Bundle::new();
let parent_scope = Scope::<COMP>::new(None).to_any();
let hosting_root = BSubtree::create_root(&host);
app.scope.mount_in_place(
hosting_root,
host,
let scope = bundle.reconcile_vchild(
&hosting_root,
&parent_scope,
&host,
NodeRef::default(),
NodeRef::default(),
props,
VChild {
props,
node_ref: NodeRef::default(),
key: None,
},
);

app
Self { scope }
}

/// Schedule the app for destruction
Expand Down
Loading