Replies: 1 comment 1 reply
are you asking about SSR here? |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
One of the things that I came across when implementing the Unified Imperitive Methods for Query, is when intergrating TanStack Query (or any other external data loading library for that matter) into router, when should you should await promises in the
loaderin the first place.There's a pattern where you can rely on the route-level suspense and error boundaries to trigger the
pendingComponentinstead of awaiting in the loader; Dominik gave a very good example of this pattern here: https://tkdodo.eu/blog/tan-stack-router-and-query#to-await-or-not-to-await-in-the-loaderHeres the nitpick with this: If you suspend in a component and trigger pendingComponent, it will ignore
pendingMsand show thependingComponetimmediately. This was something I've been aware of since I raised it back in the Query RFC at TanStack/query#9135 (reply in thread) but it obviously needs a proper discussion here in router.Is always showing the
pendingComponent/defaultPendingComponentwhen a component suspends and gets caught by the route boundary the intended behaviour, regardless of whatpendingMssays? I'm not the biggest fan of it myself (I would agree with Domninik here and just set it to 0) but if someone was to try and use it in conjuction with the "never await, always suspend" pattern it's a little unintuitive.I've set up a demo repo to show the difference between the two modes here: https://github.com/DogPawHat/pending-ms-tests-tanstack . Deployed it on netlify: https://exquisite-melomakarona-9128a5.netlify.app/
All reactions