Skip to content
Merged
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
20 changes: 8 additions & 12 deletions tachys/src/html/directive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,13 @@ pub fn directive<T, P, D>(handler: D, param: P) -> Directive<T, D, P>
where
D: IntoDirective<T, P>,
{
Directive(Some(SendWrapper::new(DirectiveInner {
handler,
param,
t: PhantomData,
})))
Directive((!cfg!(feature = "ssr")).then(|| {
SendWrapper::new(DirectiveInner {
handler,
param,
t: PhantomData,
})
}))
}

/// Custom logic that runs in the browser when the element is created or hydrated.
Expand Down Expand Up @@ -151,13 +153,7 @@ where
Directive(inner)
}

fn dry_resolve(&mut self) {
// dry_resolve() only runs during SSR, and we should use it to
// synchronously remove and drop the SendWrapper value
// we don't need this value during SSR and leaving it here could drop it
// from a different thread
self.0.take();
}
fn dry_resolve(&mut self) {}

async fn resolve(self) -> Self::AsyncOutput {
self
Expand Down
10 changes: 2 additions & 8 deletions tachys/src/html/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ where
event,
#[cfg(feature = "reactive_graph")]
owner: reactive_graph::owner::Owner::current().unwrap_or_default(),
cb: Some(SendWrapper::new(cb)),
cb: (!cfg!(feature = "ssr")).then(|| SendWrapper::new(cb)),
}
}

Expand Down Expand Up @@ -352,13 +352,7 @@ where
}
}

fn dry_resolve(&mut self) {
// dry_resolve() only runs during SSR, and we should use it to
// synchronously remove and drop the SendWrapper value
// we don't need this value during SSR and leaving it here could drop it
// from a different thread
self.cb.take();
}
fn dry_resolve(&mut self) {}

async fn resolve(self) -> Self::AsyncOutput {
self
Expand Down
10 changes: 2 additions & 8 deletions tachys/src/html/property.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ where
{
Property {
key,
value: Some(SendWrapper::new(value)),
value: (!cfg!(feature = "ssr")).then(|| SendWrapper::new(value)),
}
}

Expand Down Expand Up @@ -115,13 +115,7 @@ where
}
}

fn dry_resolve(&mut self) {
// dry_resolve() only runs during SSR, and we should use it to
// synchronously remove and drop the SendWrapper value
// we don't need this value during SSR and leaving it here could drop it
// from a different thread
self.value.take();
}
fn dry_resolve(&mut self) {}

async fn resolve(self) -> Self::AsyncOutput {
self
Expand Down
Loading