Can't make Route pendingComponent works in lazy file
Maybe I am doing something wrong but I can't make the pendingComponent appear. If someone can take a look at it 🙏
https://stackblitz.com/edit/tanstack-router-kfc1rg
PeretEtienne
StackBlitz
Router Quickstart File Based Example (forked) - StackBlitz
Run official live example code for Router Quickstart File Based, created by Tanstack on StackBlitz
2 Replies
inland-turquoise•11mo ago
I think you would want your
pendingComponent
in index.tsx
instead of index.lazy.ts
plain-purpleOP•11mo ago
pendingComponent on lazy file is supposed to work and I made it work in some circumstances but I encountered some weird behavior. I am doing a new sandbox to show that in the morning
Updated the stack blitz and there is definitely something wrong for me. I added a nested lazy route (/posts/Indes.lazy.tsx) with a pending component and the pending component appear with hard navigation. On client side navigation, neither route pending component appears. More strange, if I put a defaultPendingComponent on my createRouter I have new behaviors again. The post pending component appears now from hard and client navigation and for the home page, the pending component never appears whatever the navigation type is. I can't believe this is the normal behavior