what loading.tsx structure do I need?
Unanswered
Mallow bee posted this in #help-forum
Mallow beeOP
This is a simple todo app
- when I refresh the item page, I see the loading.tsx for the item page
- when I refresh the index, I see the loading.tsx for the index page
however when I click one of the items in the index, I see the index loading.tsx while the item page is loading. Instead I want to see the loading.tsx for the item page there. Is there a way to make this work or do I have to drop down to suspense boundaries?
todos/
[id]/
loading.tsx # matches item page
page.tsx # item page
loading.tsx # matches index page
page.tsx # index page
- when I refresh the item page, I see the loading.tsx for the item page
- when I refresh the index, I see the loading.tsx for the index page
however when I click one of the items in the index, I see the index loading.tsx while the item page is loading. Instead I want to see the loading.tsx for the item page there. Is there a way to make this work or do I have to drop down to suspense boundaries?
13 Replies
Mallow beeOP
hard refresh in browser
no real relevant code, just the file structure
loading.tsx files are just skeleton layouts that look like the page-clients
which are big client components representing the whole page and are rendered by the page.tsx server components (who fetch data and pass it as props)
Mallow beeOP
oh this might be a false positive, I just deployed and I'm getting the expected results
maybe the dev server cached an old loading.tsx
@Mallow bee This is a simple todo app
yml
todos/
[id]/
loading.tsx # matches item page
page.tsx # item page
loading.tsx # matches index page
page.tsx # index page
- when I refresh the item page, I see the loading.tsx for the item page
- when I refresh the index, I see the loading.tsx for the index page
however when I click one of the items in the index, I see the index loading.tsx while the item page is loading. Instead I want to see the loading.tsx for the item page there. Is there a way to make this work or do I have to drop down to suspense boundaries?
I tried it out locally, and when I click a item in
page.tsx
which redirects to /todos/[id]
, I'm able to see loading.tsx for item page@Mallow bee maybe the dev server cached an old loading.tsx
Yes, because I'm on latest stable version, and its working fine for me
Try deleting
.next
folderMallow beeOP
I might need to make a habit of restarting dev server after changing loading.tsx
I sometimes face this issue, and restarting sometimes help, but in some cases, I also need to delete
.next
folder