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

Serve the correct status code for not found and redirects 👌 #2582

Merged
merged 9 commits into from
Nov 26, 2024

Conversation

gregberge
Copy link
Contributor

@gregberge gregberge commented Nov 22, 2024

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 no loading.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

Copy link

changeset-bot bot commented Nov 22, 2024

⚠️ No Changeset found

Latest commit: 177e1f9

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

github-actions bot commented Nov 22, 2024

GitBook Preview
Latest commit: https://c10a92de.gitbook-open.pages.dev
PR: https://pr2582.gitbook-open.pages.dev

Copy link

argos-ci bot commented Nov 22, 2024

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) 👍 Changes approved 22 changed Nov 26, 2024, 4:36 PM

@gregberge gregberge changed the title Remove loading to serve 404 and 307 Serve the correct status code for not found and redirects 👌 Nov 24, 2024
Copy link
Member

@SamyPesse SamyPesse left a 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.

@gregberge gregberge merged commit 2b501f1 into main Nov 26, 2024
8 of 9 checks passed
@gregberge gregberge deleted the remove-loading branch November 26, 2024 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants