-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Serve the correct status code for not found and redirects 👌 #2582
Conversation
|
GitBook Preview |
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
packages/gitbook/src/app/(site)/(content)/(.)[[...pathname]]/page.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to run more tests before approving (of different caching scenarios).
But the direction looks like a good tradeoff.
packages/gitbook/src/app/(site)/(content)/(.)[[...pathname]]/page.tsx
Outdated
Show resolved
Hide resolved
packages/gitbook/src/app/(site)/(content)/(.)[[...pathname]]/loading.tsx
Outdated
Show resolved
Hide resolved
725ad6b
to
8ab7dc3
Compare
packages/gitbook/src/app/(site)/(content)/[[...pathname]]/page.tsx
Outdated
Show resolved
Hide resolved
I made some tests locally and the loading.tsx is not displayed, at least it is not perceptible. Solve RND-4299
6309d1b
to
d7010f4
Compare
By reading the code, we are already fetching things in
generateMetadata
that is awaited before the first streaming chunk is emitted. So actually the streaming is not active when we load the first page.Giving that, the only issue to solve was to enable streaming when we switch to a page dynamically (from the sidebar). By wrapping page content into
React.Suspense
it's now working.So this PR gives exactly the same result as before but it provides the good status code and redirect code.
Also refactor the code to mutualize things better.
This does not work because Next.js is waiting for
generateMetadata
if there is noloading.tsx
present. The problem is that streaming and instant loading are activated by the same thing:loading.tsx
.I am now trying to use the parallel routing to put a
loading.tsx
only for nav routing.Solve RND-4299