>>().expect("missing relevant timeline context");
+ let (loading, set_loading) = create_signal(false);
+ let id = Signal::derive(move || params.get().get("id").cloned().unwrap_or_default());
let object = create_local_resource(
- move || params.get().get("id").cloned().unwrap_or_default(),
- move |oid| async move {
+ move || (id.get(), loading.get()),
+ move |(oid, loading)| async move {
+ tracing::info!("rerunning fetcher");
let obj = cache::OBJECTS.resolve(&oid, U::Object, auth).await?;
if let Ok(author) = obj.attributed_to().id() {
cache::OBJECTS.resolve(&author, U::Actor, auth).await;
@@ -26,39 +33,69 @@ pub fn ObjectView() -> impl IntoView {
}
);
- {move || match object.get() {
- None => view! { }.into_view(),
- Some(None) => {
- let raw_id = params.get().get("id").cloned().unwrap_or_default();
- let uid = uriproxy::uri(URL_BASE, uriproxy::UriClass::Object, &raw_id);
- view! { loading failed
"↗"
}.into_view()
- },
- Some(Some(o)) => {
- let object = o.clone();
- let oid = o.id().unwrap_or_default();
- let base = Uri::web(U::Object, &oid);
- let api = Uri::api(U::Object, &oid, false);
- view!{
-
-
-
- "🕸️"" "context" | ""📫"" "replies
- {if auth.present() {
- Some(view! {
- " | ""↺"
- })
- } else { None }}
-
-
- }.into_view()
- },
- }}
+ view! {
+ {move || match object.get() {
+ None => view! { }.into_view(),
+ Some(None) => {
+ let raw_id = params.get().get("id").cloned().unwrap_or_default();
+ let uid = uriproxy::uri(URL_BASE, uriproxy::UriClass::Object, &raw_id);
+ view! { loading failed
"↗"
}.into_view()
+ },
+ Some(Some(o)) => {
+ tracing::info!("redrawing object");
+ view! { }.into_view()
+ },
+ }}
+
+
+ "🕸️ ""context"
+ "📫 ""replies"
+ {move || if auth.present() {
+ if loading.get() {
+ Some(view! {
+
+ "fetching "
+
+ })
+ } else {
+ Some(view! {
+
+
+ "↺ ""fetch"
+
+
+ })
+ }
+ } else {
+ None
+ }}
+
+
+
+ {move || if object.get().is_some() {
+ tracing::info!("redrawing outlet");
+ Some(view! { })
+ } else {
+ None
+ }}
+ }
}
-fn crawl(base: String, auth: Auth) {
+fn fetch_cb(ev: MouseEvent, set_loading: WriteSignal, oid: String, auth: Auth, config: Signal, relevant_tl: Signal