Skip to content

Core rewrites Next.js RSC streams #1340

Open

Description

@jwrosewell

One of the removals listed in #777.

What is wrong

crates/trusted-server-core/src/rsc_flight.rs rewrites the URLs inside a React Server Components Flight stream, which Next.js uses for its navigation responses and its inlined page data, and the publisher path calls it by media type. The Next.js crate (crates/framework/nextjs) carries the rest of that framework's handling, and this one piece stayed in core because it ran in the publisher path before a middleware could run on a media type other than HTML.

What changes

Why

Every framework's code leaves core, and the stack gave a middleware a media type so that a change to a text response has a place. This is the last one that predates it.

What breaks

A deployment that fronts a Next.js site names the rewriter in a [[fetch]] entry for the Flight media type, as it names the rest of the framework's middleware. Without the entry, Flight responses pass through unrewritten.

Where it is

A series on the stack, as a draft on the fork, jwrosewell#35, on top of the source module series (fork pull request 34).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions