Skip to content

Commit

Permalink
Merge pull request #1486 from leptos-rs/export-all-helpers
Browse files Browse the repository at this point in the history
fix: correctly export all DOM helpers
  • Loading branch information
gbj authored Aug 2, 2023
2 parents 248beb4 + 8320f16 commit 56f0188
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 19 deletions.
16 changes: 4 additions & 12 deletions leptos/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,18 +156,10 @@ pub mod ssr {
pub use leptos_dom::{ssr::*, ssr_in_order::*};
}
pub use leptos_dom::{
self, create_node_ref, debug_warn, document, error, ev,
helpers::{
event_target, event_target_checked, event_target_value,
request_animation_frame, request_animation_frame_with_handle,
request_idle_callback, request_idle_callback_with_handle, set_interval,
set_interval_with_handle, set_timeout, set_timeout_with_handle,
window_event_listener, window_event_listener_untyped,
},
html, log, math, mount_to, mount_to_body, nonce, svg, warn, window,
Attribute, Class, CollectView, Errors, Fragment, HtmlElement,
IntoAttribute, IntoClass, IntoProperty, IntoStyle, IntoView, NodeRef,
Property, View,
self, create_node_ref, debug_warn, document, error, ev, helpers::*, html,
log, math, mount_to, mount_to_body, nonce, svg, warn, window, Attribute,
Class, CollectView, Errors, Fragment, HtmlElement, IntoAttribute,
IntoClass, IntoProperty, IntoStyle, IntoView, NodeRef, Property, View,
};

/// Types to make it easier to handle errors in your application.
Expand Down
3 changes: 0 additions & 3 deletions leptos/src/suspense_component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,6 @@ where
let current_id = HydrationCtx::next_component();

let child = DynChild::new({
#[cfg(not(any(feature = "csr", feature = "hydrate")))]
let current_id = current_id;

let children = Rc::new(orig_children(cx).into_view(cx));
#[cfg(not(any(feature = "csr", feature = "hydrate")))]
let orig_children = Rc::clone(&orig_children);
Expand Down
1 change: 0 additions & 1 deletion leptos_dom/src/html.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1073,7 +1073,6 @@ impl<El: ElementDescriptor> IntoView for HtmlElement<El> {
let id = *element.hydration_id();

let mut element = Element::new(element);
let children = children;

if attrs.iter_mut().any(|(name, _)| name == "id") {
attrs.push(("leptos-hk".into(), format!("_{id}").into()));
Expand Down
8 changes: 6 additions & 2 deletions leptos_dom/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,12 @@ cfg_if! {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
use fmt::Write;

let attrs =
self.attrs.iter().map(|(n, v)| format!(" {n}=\"{v}\"")).collect::<String>();
let attrs = self.attrs.iter().fold(String::new(), |mut output, (n, v)| {
// can safely ignore output
// see https://rust-lang.github.io/rust-clippy/master/index.html#/format_collect
let _ = write!(output, " {n}=\"{v}\"");
output
});

if self.is_void {
write!(f, "<{}{attrs} />", self.name)
Expand Down
2 changes: 1 addition & 1 deletion leptos_reactive/src/scope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ fn push_cleanup(cx: Scope, cleanup_fn: Box<dyn FnOnce()>) {
let cleanups = cleanups
.entry(cx.id)
.expect("trying to clean up a Scope that has already been disposed")
.or_insert_with(Default::default);
.or_default();
cleanups.push(cleanup_fn);
});
}
Expand Down

0 comments on commit 56f0188

Please sign in to comment.