fix(web): signal::derive to update tags list

This commit is contained in:
əlemi 2024-08-11 15:28:52 +02:00
parent a0394ca94e
commit c7139fa39e
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -1,6 +1,6 @@
use std::sync::Arc; use std::sync::Arc;
use apb::{Base, Collection}; use apb::Collection;
use leptos::*; use leptos::*;
use leptos_router::*; use leptos_router::*;
use crate::prelude::*; use crate::prelude::*;
@ -9,7 +9,9 @@ use crate::prelude::*;
pub fn SearchPage() -> impl IntoView { pub fn SearchPage() -> impl IntoView {
let auth = use_context::<Auth>().expect("missing auth context"); let auth = use_context::<Auth>().expect("missing auth context");
let query = use_query_map().get().get("q").cloned().unwrap_or_default(); let query = Signal::derive(||
use_query_map().with(|x| x.get("q").cloned().unwrap_or_default())
);
let user = create_local_resource( let user = create_local_resource(
move || use_query_map().get().get("q").cloned().unwrap_or_default(), move || use_query_map().get().get("q").cloned().unwrap_or_default(),
@ -78,7 +80,7 @@ pub fn SearchPage() -> impl IntoView {
</summary> </summary>
<div class="pb-1"> <div class="pb-1">
<ul> <ul>
<li><a href={format!("/web/tags/{query}")}>#{query}</a></li> <li><a href={format!("/web/tags/{}", query.get())}>#{query}</a></li>
</ul> </ul>
</div> </div>
</details> </details>