#Suspense fallback isn't being rendered

1 messages ยท Page 1 of 1 (latest)

lyric tendon
#

hey there ๐Ÿ‘‹

i've just tried to defer the data i'm returning from a loader to be able to fallback to a skeleton while the data is being loaded.

however, it seems like i'm missing something, because the fallback is never being rendered. i've already tried to throttle my network connection and still nothing.

here is the route file: https://github.com/ubmit/fuzzy-movie/blob/44f0f8771a8ac827c537033c9c15a9eb0e941e2d/app/routes/_index.tsx#L97

thanks!

GitHub

Contribute to ubmit/fuzzy-movie development by creating an account on GitHub.

tight otter
lyric tendon
#

damn, totally missed it! tysm!!! ๐Ÿ™Œ

tight otter
#

no prob, easy thing to miss.

#

Honestly, it's more impressive that Remix keeps chuckling along instead of erroring out somewhere.

#

Sometimes the DX is too good, lol!

lyric tendon
#

yeah it would be nice to have an error there! i really thought this would be it, but the fallback is still not being rendered

#

still missing something here ๐Ÿ”

#

hold on! it's working on 1st load, but after my form is submitted the fallback doesn't seem to be working

#

I'll investigate that another day, thanks for the help

#

just to clarify what I meant:

-> if the loader gets the query from the search param, then the suspense works as expected https://fuzzy-movie.fly.dev/?search=interstellar

-> if the form is submitted, however, the suspense doesn't happen at all

meager spruce
#

Having tested it locally, it does behave as I think it should. The way to think of it is that on the first request the document gets built up and sent over despite some data still being pending, then that pending data is streamed in when ready. Once it's been streamed in and you update the search param then your waiting for the new response, but remix says "I've already got this data on the front-end and the new data hasn't resolved from the server yet, so why not show the information I already have until the new data is ready"

#

This makes your specific project goal a bit more difficult, but I think it's the correct assumption for most users since you're unlikely to have radically different results on a single page. This might be a better place to use something like kent's full stack components

#

and manage loading states manually yourself. defer Await is more intended to speed up first paint of the html not create loading zones for you automatically

tight otter
#

Here's some old discussion about this when defer was first introduced: #react-router-general message

#

the recommended way to useNavigation to render pending state on subsequent client renders.