Skip to content

Commit

Permalink
Update unused file
Browse files Browse the repository at this point in the history
  • Loading branch information
zakstucke committed Feb 6, 2025
1 parent d22d2f9 commit 71774c7
Showing 1 changed file with 33 additions and 11 deletions.
44 changes: 33 additions & 11 deletions router/src/reactive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,11 @@ where
}
}

fn rebuild(self, state: &mut Self::State, _extra_attrs: Option<Vec<AnyAttribute>>) {
fn rebuild(
self,
state: &mut Self::State,
_extra_attrs: Option<Vec<AnyAttribute>>,
) {
let (new_id, view) = self.inner.fallback_or_view();
if new_id != state.prev_id {
state.owner = self.owner.with(Owner::new)
Expand Down Expand Up @@ -283,7 +287,7 @@ where
{
type State = ReactiveRouteState<View::State>;

fn build(self, _extra_attrs: Option<Vec<AnyAttribute>>) -> Self::State {
fn build(self, extra_attrs: Option<Vec<AnyAttribute>>) -> Self::State {
let MatchedRoute {
search_params,
params,
Expand All @@ -294,14 +298,19 @@ where
params: ArcRwSignal::new(params),
matched: ArcRwSignal::new(matched),
};
let view_state = untrack(|| (self.view_fn)(&matched).build());
let view_state =
untrack(|| (self.view_fn)(&matched).build(extra_attrs.clone()));
ReactiveRouteState {
matched,
view_state,
}
}

fn rebuild(mut self, state: &mut Self::State) {
fn rebuild(
mut self,
state: &mut Self::State,
_extra_attrs: Option<Vec<AnyAttribute>>,
) {
let ReactiveRouteState { matched, .. } = state;
matched
.search_params
Expand All @@ -327,7 +336,7 @@ where
position: &mut Position,
escape: bool,
mark_branches: bool,
_extra_attrs: Option<Vec<AnyAttribute>>,
extra_attrs: Option<Vec<AnyAttribute>>,
) {
let MatchedRoute {
search_params,
Expand All @@ -340,7 +349,12 @@ where
matched: ArcRwSignal::new(matched),
};
untrack(|| {
(self.view_fn)(&matched).to_html_with_buf(buf, position, escape)
(self.view_fn)(&matched).to_html_with_buf(
buf,
position,
escape,
extra_attrs.clone(),
)
});
}

Expand All @@ -350,7 +364,7 @@ where
position: &mut Position,
escape: bool,
mark_branches: bool,
_extra_attrs: Option<Vec<AnyAttribute>>,
extra_attrs: Option<Vec<AnyAttribute>>,
) where
Self: Sized,
{
Expand All @@ -365,16 +379,20 @@ where
matched: ArcRwSignal::new(matched),
};
untrack(|| {
(self.view_fn)(&matched)
.to_html_async_with_buf::<OUT_OF_ORDER>(buf, position, escape)
(self.view_fn)(&matched).to_html_async_with_buf::<OUT_OF_ORDER>(
buf,
position,
escape,
extra_attrs.clone(),
)
});
}

fn hydrate<const FROM_SERVER: bool>(
self,
cursor: &Cursor,
position: &PositionState,
_extra_attrs: Option<Vec<AnyAttribute>>,
extra_attrs: Option<Vec<AnyAttribute>>,
) -> Self::State {
let MatchedRoute {
search_params,
Expand All @@ -387,7 +405,11 @@ where
matched: ArcRwSignal::new(matched),
};
let view_state = untrack(|| {
(self.view_fn)(&matched).hydrate::<FROM_SERVER>(cursor, position)
(self.view_fn)(&matched).hydrate::<FROM_SERVER>(
cursor,
position,
extra_attrs.clone(),
)
});
ReactiveRouteState {
matched,
Expand Down

0 comments on commit 71774c7

Please sign in to comment.