fix(web): user page responds to url again

This commit is contained in:
əlemi 2024-05-29 22:14:15 +02:00
parent e3831650ca
commit 7019671f93
Signed by: alemi
GPG key ID: A4895B84D311642C
2 changed files with 16 additions and 15 deletions

View file

@ -34,8 +34,7 @@ pub fn App() -> impl IntoView {
let (menu, set_menu) = create_signal(screen_width <= 786); let (menu, set_menu) = create_signal(screen_width <= 786);
let (advanced, set_advanced) = create_signal(false); let (advanced, set_advanced) = create_signal(false);
let auth_present = auth.token.get_untracked().is_some(); // skip helper to use get_untracked let title_target = move || if auth.present() { "/web/home" } else { "/web/server" };
let title_target = move || if auth_present { "/web/home" } else { "/web/server" };
if let Some(tok) = token.get_untracked() { if let Some(tok) = token.get_untracked() {
spawn_local(async move { spawn_local(async move {
@ -61,7 +60,7 @@ pub fn App() -> impl IntoView {
server_tl.more(auth); server_tl.more(auth);
local_tl.more(auth); local_tl.more(auth);
if auth_present { home_tl.more(auth) }; if auth.token.get_untracked().is_some() { home_tl.more(auth) };
}) })
} else { } else {
server_tl.more(auth); server_tl.more(auth);

View file

@ -28,8 +28,9 @@ pub fn UserPage(tl: Timeline) -> impl IntoView {
.cloned() .cloned()
.unwrap_or_default(); .unwrap_or_default();
let uid = uriproxy::uri(URL_BASE, uriproxy::UriClass::Actor, &id); let uid = uriproxy::uri(URL_BASE, uriproxy::UriClass::Actor, &id);
let _uid = uid.clone(); let actor = create_local_resource(
let actor = create_local_resource(move || _uid.clone(), move |id| { move || params.get().get("id").cloned().unwrap_or_default(),
move |id| {
async move { async move {
match CACHE.get(&Uri::full(U::Actor, &id)) { match CACHE.get(&Uri::full(U::Actor, &id)) {
Some(x) => Some(x.clone()), Some(x) => Some(x.clone()),
@ -41,7 +42,8 @@ pub fn UserPage(tl: Timeline) -> impl IntoView {
}, },
} }
} }
}); }
);
view! { view! {
<div> <div>
<Breadcrumb back=true > <Breadcrumb back=true >