forge
Explore
Log in

Don't you dare go Hollow

A refetch keeps the screen it already drew

Browse files at this commit

f91ac00f66b9fa0129574e798154bc0a8a4d2074Ahmet Kaan GümüşParent: 44f2520
  • fix
    • a refetch keeps the screen it already drew
Show full message
💄 fix(ui): a refetch keeps the screen it already drew

Every screen's Resource sat in a Suspense boundary, so each mutation's
refetch dropped to the blank fallback and the whole view flickered.
Transition keeps the previous children while the new snapshot loads;
the fallback now shows only before first data.
crates/izlek-web/src/board.rsmodified+3 -3
@@ -181,7 +181,7 @@ impl Filter {
181181 pub fn Board() -> impl IntoView {
182182 let board = Resource::new(|| (), |_| async move { current_board().await });
183183 // Which card is open in the detail modal, if any. It lives out here, above
184- // the suspense boundary: a refetch rebuilds `BoardScreen` from scratch, and
184+ // the transition boundary: a refetch rebuilds `BoardScreen` from scratch, and
185185 // a signal owned by that component would be born empty again — closing the
186186 // modal every time something inside it saved.
187187 // Seeded from `?task=`, so a card is a link and the modal has an address. A
@@ -194,7 +194,7 @@ pub fn Board() -> impl IntoView {
194194 );
195195
196196 view! {
197- <Suspense fallback=|| {
197+ <Transition fallback=|| {
198198 view! { <main class="board-stage"></main> }
199199 }>
200200 {move || Suspend::new(async move {
@@ -227,7 +227,7 @@ pub fn Board() -> impl IntoView {
227227 }
228228 }
229229 })}
230- </Suspense>
230+ </Transition>
231231 }
232232 }
233233
crates/izlek-web/src/detail.rsmodified+2 -2
@@ -647,7 +647,7 @@ pub fn TaskDetailModal(
647647 view! {
648648 <div class="modal-scrim" on:click=move |_| on_close()>
649649 <div class="modal" tabindex="-1" on:click=move |event| event.stop_propagation()>
650- <Suspense fallback=|| {
650+ <Transition fallback=|| {
651651 view! { <div class="modal-loading"></div> }
652652 }>
653653 {move || Suspend::new(async move {
@@ -673,7 +673,7 @@ pub fn TaskDetailModal(
673673 }
674674 }
675675 })}
676- </Suspense>
676+ </Transition>
677677 </div>
678678 </div>
679679 }
crates/izlek-web/src/pages.rsmodified+4 -4
@@ -17,7 +17,7 @@ pub fn Landing() -> impl IntoView {
1717 let gate = Resource::new(|| (), |_| async move { current_gate().await });
1818
1919 view! {
20- <Suspense fallback=|| view! { <main class="auth-stage"></main> }>
20+ <Transition fallback=|| view! { <main class="auth-stage"></main> }>
2121 {move || Suspend::new(async move {
2222 match gate.await {
2323 Ok(Gate::NeedsSetup) => {
@@ -46,7 +46,7 @@ pub fn Landing() -> impl IntoView {
4646 }
4747 }
4848 })}
49- </Suspense>
49+ </Transition>
5050 }
5151 }
5252
@@ -140,7 +140,7 @@ pub fn Join() -> impl IntoView {
140140 let who = Resource::new(token, |token| async move { invitation(token).await });
141141
142142 view! {
143- <Suspense fallback=|| view! { <main class="auth-stage"></main> }>
143+ <Transition fallback=|| view! { <main class="auth-stage"></main> }>
144144 {move || Suspend::new(async move {
145145 match who.await {
146146 Ok(Some(person)) => view! { <JoinCard token=token() person=person/> }.into_any(),
@@ -159,7 +159,7 @@ pub fn Join() -> impl IntoView {
159159 }
160160 }
161161 })}
162- </Suspense>
162+ </Transition>
163163 }
164164 }
165165
crates/izlek-web/src/rules.rsmodified+2 -2
@@ -265,7 +265,7 @@ pub fn RulesPage() -> impl IntoView {
265265 let rules = Resource::new(|| (), |_| async move { current_rules().await });
266266
267267 view! {
268- <Suspense fallback=|| view! { <main class="settings-stage"></main> }>
268+ <Transition fallback=|| view! { <main class="settings-stage"></main> }>
269269 {move || Suspend::new(async move {
270270 match rules.await {
271271 Ok(Ok(snapshot)) => {
@@ -298,7 +298,7 @@ pub fn RulesPage() -> impl IntoView {
298298 }
299299 }
300300 })}
301- </Suspense>
301+ </Transition>
302302 }
303303 }
304304
crates/izlek-web/src/settings.rsmodified+3 -3
@@ -510,7 +510,7 @@ pub async fn save_profile(display_name: String) -> Result<Option<Refusal>, Serve
510510 pub fn SettingsPage() -> impl IntoView {
511511 let settings = Resource::new(|| (), |_| async move { current_settings().await });
512512 // The link a call hands back, and the word for a call that was refused.
513- // They live here, above the Suspense, because a successful call refetches
513+ // They live here, above the Transition, because a successful call refetches
514514 // the snapshot: signals owned by the members panel would be dropped with it
515515 // and the link — which the store keeps only as a hash — would be gone for
516516 // good before anyone could read it.
@@ -518,7 +518,7 @@ pub fn SettingsPage() -> impl IntoView {
518518 let link_refusal = RwSignal::new(None::<String>);
519519
520520 view! {
521- <Suspense fallback=|| view! { <main class="settings-stage"></main> }>
521+ <Transition fallback=|| view! { <main class="settings-stage"></main> }>
522522 {move || Suspend::new(async move {
523523 match settings.await {
524524 Ok(Ok(snapshot)) => {
@@ -553,7 +553,7 @@ pub fn SettingsPage() -> impl IntoView {
553553 }
554554 }
555555 })}
556- </Suspense>
556+ </Transition>
557557 }
558558 }
559559