Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update usage-next-13.mdx: Hint at loading.tsx files #846

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tordans
Copy link
Contributor

@tordans tordans commented Oct 10, 2023

The fact that layouts need to be handled differently in the app folder becomes very clear right from the start. However, the possible changes using the special loading files is a bit more hidden, which is why I suggest hinting at it in the migration docs.

@vercel
Copy link

vercel bot commented Oct 10, 2023

@tordans is attempting to deploy a commit to the Blitz Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Member

@siddhsuresh siddhsuresh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So while technically true, a loading.tsx file will wrap the entire page.tsx inside a suspense boundary, which users might not expect. Unless the dev is using invoke to get the data and render in page.tsx.

Otherwise keeping <Suspense> would be a good bet to suspend on the required parts of the UI especially when using useQuery and its siblings.

@tordans
Copy link
Contributor Author

tordans commented Oct 13, 2023

@siddhsuresh looking at a regular pages-page like https://github.com/blitz-js/blitz/blob/main/packages/generator/templates/page/__modelIdParam__.tsx#L84-L86 everything except for the one Link is part of the Suspense. Which is IMO 99% of what loading.tsx does, is it not? The only think i loos it this one link which only shows up after loading is done. I gain, however, a much simpler __modelIdParam__.tsx file with just one regular component.

The loading.tsx is still wrapped inside the nested layouts that apply to it, so it's still a Suspense/loading-animation in the context of the layout — AKA this part does not change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Review
Development

Successfully merging this pull request may close these issues.

3 participants