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 {
181 pub fn Board() -> impl IntoView {181 pub fn Board() -> impl IntoView {
182 let board = Resource::new(|| (), |_| async move { current_board().await });182 let board = Resource::new(|| (), |_| async move { current_board().await });
183 // Which card is open in the detail modal, if any. It lives out here, above183 // 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, and184+ // the transition boundary: a refetch rebuilds `BoardScreen` from scratch, and
185 // a signal owned by that component would be born empty again — closing the185 // a signal owned by that component would be born empty again — closing the
186 // modal every time something inside it saved.186 // modal every time something inside it saved.
187 // Seeded from `?task=`, so a card is a link and the modal has an address. A187 // 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 {
194 );194 );
195 195
196 view! {196 view! {
197- <Suspense fallback=|| {197+ <Transition fallback=|| {
198 view! { <main class="board-stage"></main> }198 view! { <main class="board-stage"></main> }
199 }>199 }>
200 {move || Suspend::new(async move {200 {move || Suspend::new(async move {
@@ -227,7 +227,7 @@ pub fn Board() -> impl IntoView {
227 }227 }
228 }228 }
229 })}229 })}
230- </Suspense>230+ </Transition>
231 }231 }
232 }232 }
233 233
crates/izlek-web/src/detail.rsmodified+2 -2
@@ -647,7 +647,7 @@ pub fn TaskDetailModal(
647 view! {647 view! {
648 <div class="modal-scrim" on:click=move |_| on_close()>648 <div class="modal-scrim" on:click=move |_| on_close()>
649 <div class="modal" tabindex="-1" on:click=move |event| event.stop_propagation()>649 <div class="modal" tabindex="-1" on:click=move |event| event.stop_propagation()>
650- <Suspense fallback=|| {650+ <Transition fallback=|| {
651 view! { <div class="modal-loading"></div> }651 view! { <div class="modal-loading"></div> }
652 }>652 }>
653 {move || Suspend::new(async move {653 {move || Suspend::new(async move {
@@ -673,7 +673,7 @@ pub fn TaskDetailModal(
673 }673 }
674 }674 }
675 })}675 })}
676- </Suspense>676+ </Transition>
677 </div>677 </div>
678 </div>678 </div>
679 }679 }
crates/izlek-web/src/pages.rsmodified+4 -4
@@ -17,7 +17,7 @@ pub fn Landing() -> impl IntoView {
17 let gate = Resource::new(|| (), |_| async move { current_gate().await });17 let gate = Resource::new(|| (), |_| async move { current_gate().await });
18 18
19 view! {19 view! {
20- <Suspense fallback=|| view! { <main class="auth-stage"></main> }>20+ <Transition fallback=|| view! { <main class="auth-stage"></main> }>
21 {move || Suspend::new(async move {21 {move || Suspend::new(async move {
22 match gate.await {22 match gate.await {
23 Ok(Gate::NeedsSetup) => {23 Ok(Gate::NeedsSetup) => {
@@ -46,7 +46,7 @@ pub fn Landing() -> impl IntoView {
46 }46 }
47 }47 }
48 })}48 })}
49- </Suspense>49+ </Transition>
50 }50 }
51 }51 }
52 52
@@ -140,7 +140,7 @@ pub fn Join() -> impl IntoView {
140 let who = Resource::new(token, |token| async move { invitation(token).await });140 let who = Resource::new(token, |token| async move { invitation(token).await });
141 141
142 view! {142 view! {
143- <Suspense fallback=|| view! { <main class="auth-stage"></main> }>143+ <Transition fallback=|| view! { <main class="auth-stage"></main> }>
144 {move || Suspend::new(async move {144 {move || Suspend::new(async move {
145 match who.await {145 match who.await {
146 Ok(Some(person)) => view! { <JoinCard token=token() person=person/> }.into_any(),146 Ok(Some(person)) => view! { <JoinCard token=token() person=person/> }.into_any(),
@@ -159,7 +159,7 @@ pub fn Join() -> impl IntoView {
159 }159 }
160 }160 }
161 })}161 })}
162- </Suspense>162+ </Transition>
163 }163 }
164 }164 }
165 165
crates/izlek-web/src/rules.rsmodified+2 -2
@@ -265,7 +265,7 @@ pub fn RulesPage() -> impl IntoView {
265 let rules = Resource::new(|| (), |_| async move { current_rules().await });265 let rules = Resource::new(|| (), |_| async move { current_rules().await });
266 266
267 view! {267 view! {
268- <Suspense fallback=|| view! { <main class="settings-stage"></main> }>268+ <Transition fallback=|| view! { <main class="settings-stage"></main> }>
269 {move || Suspend::new(async move {269 {move || Suspend::new(async move {
270 match rules.await {270 match rules.await {
271 Ok(Ok(snapshot)) => {271 Ok(Ok(snapshot)) => {
@@ -298,7 +298,7 @@ pub fn RulesPage() -> impl IntoView {
298 }298 }
299 }299 }
300 })}300 })}
301- </Suspense>301+ </Transition>
302 }302 }
303 }303 }
304 304
crates/izlek-web/src/settings.rsmodified+3 -3
@@ -510,7 +510,7 @@ pub async fn save_profile(display_name: String) -> Result<Option<Refusal>, Serve
510 pub fn SettingsPage() -> impl IntoView {510 pub fn SettingsPage() -> impl IntoView {
511 let settings = Resource::new(|| (), |_| async move { current_settings().await });511 let settings = Resource::new(|| (), |_| async move { current_settings().await });
512 // The link a call hands back, and the word for a call that was refused.512 // 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 refetches513+ // They live here, above the Transition, because a successful call refetches
514 // the snapshot: signals owned by the members panel would be dropped with it514 // the snapshot: signals owned by the members panel would be dropped with it
515 // and the link — which the store keeps only as a hash — would be gone for515 // and the link — which the store keeps only as a hash — would be gone for
516 // good before anyone could read it.516 // good before anyone could read it.
@@ -518,7 +518,7 @@ pub fn SettingsPage() -> impl IntoView {
518 let link_refusal = RwSignal::new(None::<String>);518 let link_refusal = RwSignal::new(None::<String>);
519 519
520 view! {520 view! {
521- <Suspense fallback=|| view! { <main class="settings-stage"></main> }>521+ <Transition fallback=|| view! { <main class="settings-stage"></main> }>
522 {move || Suspend::new(async move {522 {move || Suspend::new(async move {
523 match settings.await {523 match settings.await {
524 Ok(Ok(snapshot)) => {524 Ok(Ok(snapshot)) => {
@@ -553,7 +553,7 @@ pub fn SettingsPage() -> impl IntoView {
553 }553 }
554 }554 }
555 })}555 })}
556- </Suspense>556+ </Transition>
557 }557 }
558 }558 }
559 559