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
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/async_clock/Trunk.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[tools]
wasm_opt = "version_129"
wasm_opt = "version_131"
2 changes: 1 addition & 1 deletion examples/boids/Trunk.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[tools]
wasm_opt = "version_129"
wasm_opt = "version_131"
2 changes: 1 addition & 1 deletion examples/communication_child_to_parent/Trunk.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[tools]
wasm_opt = "version_129"
wasm_opt = "version_131"
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[tools]
wasm_opt = "version_129"
wasm_opt = "version_131"
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[tools]
wasm_opt = "version_129"
wasm_opt = "version_131"
2 changes: 1 addition & 1 deletion examples/communication_parent_to_child/Trunk.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[tools]
wasm_opt = "version_129"
wasm_opt = "version_131"
2 changes: 1 addition & 1 deletion examples/contexts/Trunk.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[tools]
wasm_opt = "version_129"
wasm_opt = "version_131"
2 changes: 1 addition & 1 deletion examples/counter/Trunk.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[tools]
wasm_opt = "version_129"
wasm_opt = "version_131"
2 changes: 1 addition & 1 deletion examples/counter_functional/Trunk.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[tools]
wasm_opt = "version_129"
wasm_opt = "version_131"
2 changes: 1 addition & 1 deletion examples/dyn_create_destroy_apps/Trunk.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[tools]
wasm_opt = "version_129"
wasm_opt = "version_131"
2 changes: 1 addition & 1 deletion examples/file_upload/Trunk.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[tools]
wasm_opt = "version_129"
wasm_opt = "version_131"
2 changes: 1 addition & 1 deletion examples/function_delayed_input/Trunk.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[tools]
wasm_opt = "version_129"
wasm_opt = "version_131"
2 changes: 1 addition & 1 deletion examples/function_memory_game/Trunk.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[tools]
wasm_opt = "version_129"
wasm_opt = "version_131"
2 changes: 1 addition & 1 deletion examples/function_router/Trunk.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[tools]
wasm_opt = "version_129"
wasm_opt = "version_131"
2 changes: 1 addition & 1 deletion examples/function_todomvc/Trunk.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[tools]
wasm_opt = "version_129"
wasm_opt = "version_131"
2 changes: 1 addition & 1 deletion examples/futures/Trunk.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[tools]
wasm_opt = "version_129"
wasm_opt = "version_131"
2 changes: 1 addition & 1 deletion examples/game_of_life/Trunk.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[tools]
wasm_opt = "version_129"
wasm_opt = "version_131"
2 changes: 1 addition & 1 deletion examples/immutable/Trunk.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[tools]
wasm_opt = "version_129"
wasm_opt = "version_131"
2 changes: 1 addition & 1 deletion examples/inner_html/Trunk.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[tools]
wasm_opt = "version_129"
wasm_opt = "version_131"
2 changes: 1 addition & 1 deletion examples/js_callback/Trunk.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tools]
wasm_opt = "version_129"
wasm_opt = "version_131"

[[hooks]]
stage = "pre_build"
Expand Down
2 changes: 1 addition & 1 deletion examples/keyed_list/Trunk.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[tools]
wasm_opt = "version_129"
wasm_opt = "version_131"
2 changes: 1 addition & 1 deletion examples/mount_point/Trunk.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[tools]
wasm_opt = "version_129"
wasm_opt = "version_131"
2 changes: 1 addition & 1 deletion examples/nested_list/Trunk.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[tools]
wasm_opt = "version_129"
wasm_opt = "version_131"
2 changes: 1 addition & 1 deletion examples/node_refs/Trunk.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[tools]
wasm_opt = "version_129"
wasm_opt = "version_131"
2 changes: 1 addition & 1 deletion examples/password_strength/Trunk.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[tools]
wasm_opt = "version_129"
wasm_opt = "version_131"
2 changes: 1 addition & 1 deletion examples/portals/Trunk.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[tools]
wasm_opt = "version_129"
wasm_opt = "version_131"
2 changes: 1 addition & 1 deletion examples/router/Trunk.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[tools]
wasm_opt = "version_129"
wasm_opt = "version_131"
2 changes: 1 addition & 1 deletion examples/suspense/Trunk.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[tools]
wasm_opt = "version_129"
wasm_opt = "version_131"
2 changes: 1 addition & 1 deletion examples/timer/Trunk.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[tools]
wasm_opt = "version_129"
wasm_opt = "version_131"
2 changes: 1 addition & 1 deletion examples/timer_functional/Trunk.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[tools]
wasm_opt = "version_129"
wasm_opt = "version_131"
2 changes: 1 addition & 1 deletion examples/todomvc/Trunk.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[tools]
wasm_opt = "version_129"
wasm_opt = "version_131"
2 changes: 1 addition & 1 deletion examples/two_apps/Trunk.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[tools]
wasm_opt = "version_129"
wasm_opt = "version_131"
2 changes: 1 addition & 1 deletion examples/web_worker_fib/Trunk.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[tools]
wasm_opt = "version_129"
wasm_opt = "version_131"
2 changes: 1 addition & 1 deletion examples/web_worker_prime/Trunk.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[tools]
wasm_opt = "version_129"
wasm_opt = "version_131"
2 changes: 1 addition & 1 deletion examples/webgl/Trunk.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[tools]
wasm_opt = "version_129"
wasm_opt = "version_131"
8 changes: 2 additions & 6 deletions packages/yew/src/app_handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ fn clear_element(host: &Element) {
#[cfg(feature = "hydration")]
mod feat_hydration {
use super::*;
use crate::dom_bundle::Fragment;
use crate::dom_bundle::{Fragment, SlotBulletin};

impl<COMP> AppHandle<COMP>
where
Expand All @@ -106,17 +106,13 @@ mod feat_hydration {
let mut fragment = Fragment::collect_children(&host);
let hosting_root = BSubtree::create_root(&host);

let mut previous_next_sibling = None;
app.scope.hydrate_in_place(
hosting_root,
host.clone(),
&mut fragment,
Rc::clone(&props),
&mut previous_next_sibling,
&mut SlotBulletin::new(),
);
if let Some(previous_next_sibling) = previous_next_sibling {
previous_next_sibling.reassign(DomSlot::at_end());
}

// We remove all remaining nodes, this mimics the clear_element behaviour in
// mount_with_props.
Expand Down
28 changes: 14 additions & 14 deletions packages/yew/src/dom_bundle/bcomp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::fmt;

use web_sys::Element;

use super::{BNode, BSubtree, DomSlot, DynamicDomSlot, Reconcilable, ReconcileTarget};
use super::{BNode, BSubtree, DomSlot, Reconcilable, ReconcileTarget};
use crate::html::{AnyScope, Scoped};
use crate::virtual_dom::{Key, VComp};

Expand All @@ -16,7 +16,7 @@ pub(super) struct BComp {
scope: Box<dyn Scoped>,
/// An internal [`DomSlot`] passed around to track this components position. This
/// will dynamically adjust when a lifecycle changes the render state of this component.
own_position: DynamicDomSlot,
own_position: DomSlot,
key: Option<Key>,
}

Expand All @@ -43,7 +43,7 @@ impl ReconcileTarget for BComp {
fn shift(&self, next_parent: &Element, slot: DomSlot) -> DomSlot {
self.scope.shift_node(next_parent.clone(), slot);

self.own_position.to_position()
self.own_position.clone()
}
}

Expand All @@ -64,14 +64,14 @@ impl Reconcilable for VComp {
..
} = self;

let (scope, internal_ref) = mountable.mount(root, parent_scope, parent.to_owned(), slot);
let (scope, own_position) = mountable.mount(root, parent_scope, parent.to_owned(), slot);

(
internal_ref.to_position(),
own_position.clone(),
BComp {
type_id,
scope,
own_position: internal_ref,
own_position,
key,
},
)
Expand Down Expand Up @@ -106,14 +106,14 @@ impl Reconcilable for VComp {

bcomp.key = key;
mountable.reuse(bcomp.scope.borrow(), slot);
bcomp.own_position.to_position()
bcomp.own_position.clone()
}
}

#[cfg(feature = "hydration")]
mod feat_hydration {
use super::*;
use crate::dom_bundle::{Fragment, Hydratable};
use crate::dom_bundle::{Fragment, Hydratable, SlotBulletin};

impl Hydratable for VComp {
fn hydrate(
Expand All @@ -122,7 +122,7 @@ mod feat_hydration {
parent_scope: &AnyScope,
parent: &Element,
fragment: &mut Fragment,
prev_next_sibling: &mut Option<DynamicDomSlot>,
prev_next_sibling: &mut SlotBulletin<'_>,
) -> Self::Bundle {
let VComp {
type_id,
Expand Down Expand Up @@ -207,19 +207,19 @@ mod tests {

#[test]
fn set_properties_to_component() {
html! {
let _ = html! {
<Comp />
};

html! {
let _ = html! {
<Comp field_1=1 />
};

html! {
let _ = html! {
<Comp field_2=2 />
};

html! {
let _ = html! {
<Comp field_1=1 field_2=2 />
};

Expand All @@ -228,7 +228,7 @@ mod tests {
field_2: 1,
};

html! {
let _ = html! {
<Comp ..props />
};
}
Expand Down
4 changes: 2 additions & 2 deletions packages/yew/src/dom_bundle/blist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ impl Reconcilable for VList {
#[cfg(feature = "hydration")]
mod feat_hydration {
use super::*;
use crate::dom_bundle::{DynamicDomSlot, Fragment, Hydratable};
use crate::dom_bundle::{Fragment, Hydratable, SlotBulletin};

impl Hydratable for VList {
fn hydrate(
Expand All @@ -525,7 +525,7 @@ mod feat_hydration {
parent_scope: &AnyScope,
parent: &Element,
fragment: &mut Fragment,
prev_next_sibling: &mut Option<DynamicDomSlot>,
prev_next_sibling: &mut SlotBulletin<'_>,
) -> Self::Bundle {
let (key, fully_keyed, vchildren) = self.split_for_blist();

Expand Down
4 changes: 2 additions & 2 deletions packages/yew/src/dom_bundle/bnode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ impl fmt::Debug for BNode {
#[cfg(feature = "hydration")]
mod feat_hydration {
use super::*;
use crate::dom_bundle::{DynamicDomSlot, Fragment, Hydratable};
use crate::dom_bundle::{Fragment, Hydratable, SlotBulletin};

impl Hydratable for VNode {
fn hydrate(
Expand All @@ -276,7 +276,7 @@ mod feat_hydration {
parent_scope: &AnyScope,
parent: &Element,
fragment: &mut Fragment,
prev_next_sibling: &mut Option<DynamicDomSlot>,
prev_next_sibling: &mut SlotBulletin<'_>,
) -> Self::Bundle {
match self {
VNode::VTag(vtag) => RcExt::unwrap_or_clone(vtag)
Expand Down
11 changes: 4 additions & 7 deletions packages/yew/src/dom_bundle/braw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ impl Reconcilable for VRaw {
#[cfg(feature = "hydration")]
mod feat_hydration {
use super::*;
use crate::dom_bundle::{DynamicDomSlot, Fragment, Hydratable};
use crate::dom_bundle::{Fragment, Hydratable, SlotBulletin};
use crate::virtual_dom::Collectable;

impl Hydratable for VRaw {
Expand All @@ -156,17 +156,14 @@ mod feat_hydration {
_parent_scope: &AnyScope,
parent: &Element,
fragment: &mut Fragment,
prev_next_sibling: &mut Option<DynamicDomSlot>,
prev_next_sibling: &mut SlotBulletin<'_>,
) -> Self::Bundle {
let collectable = Collectable::Raw;
let fallback_fragment = Fragment::collect_between(fragment, &collectable, parent);
let first_child = fallback_fragment.iter().next().cloned();

if let (Some(first_child), prev_next_sibling) = (&first_child, prev_next_sibling) {
if let Some(prev_next_sibling) = prev_next_sibling {
prev_next_sibling.reassign(DomSlot::at(first_child.clone()));
}
*prev_next_sibling = None;
if let Some(first_child) = &first_child {
prev_next_sibling.write_at_node(first_child.clone());
}

let Self { html } = self;
Expand Down
4 changes: 2 additions & 2 deletions packages/yew/src/dom_bundle/bsuspense.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ impl Reconcilable for VSuspense {
#[cfg(feature = "hydration")]
mod feat_hydration {
use super::*;
use crate::dom_bundle::{DynamicDomSlot, Fragment, Hydratable};
use crate::dom_bundle::{Fragment, Hydratable, SlotBulletin};
use crate::virtual_dom::Collectable;

impl Hydratable for VSuspense {
Expand All @@ -234,7 +234,7 @@ mod feat_hydration {
parent_scope: &AnyScope,
parent: &Element,
fragment: &mut Fragment,
previous_next_sibling: &mut Option<DynamicDomSlot>,
previous_next_sibling: &mut SlotBulletin<'_>,
) -> Self::Bundle {
let detached_parent = document()
.create_element("div")
Expand Down
Loading
Loading