Skip to content

Conversation

brophdawg11
Copy link
Contributor

No description provided.

Copy link

changeset-bot bot commented Aug 5, 2025

🦋 Changeset detected

Latest commit: 908f6a7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 11 packages
Name Type
react-router Patch
@react-router/architect Patch
@react-router/cloudflare Patch
@react-router/dev Patch
react-router-dom Patch
@react-router/express Patch
@react-router/node Patch
@react-router/serve Patch
@react-router/fs-routes Patch
@react-router/remix-routes-option-adapter Patch
create-react-router Patch

Not sure what this means? Click here to learn what changesets are.

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

@brophdawg11 brophdawg11 force-pushed the brophdawg11/middleware-data branch from 5ec2880 to 908f6a7 Compare August 5, 2025 19:17
@brophdawg11 brophdawg11 merged commit 59dd6c9 into release-next Aug 5, 2025
8 checks passed
@brophdawg11 brophdawg11 deleted the brophdawg11/middleware-data branch August 5, 2025 20:04
Copy link
Contributor

github-actions bot commented Aug 5, 2025

🤖 Hello there,

We just published version 7.8.0-pre.1 which includes this pull request. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

Copy link
Contributor

github-actions bot commented Aug 6, 2025

🤖 Hello there,

We just published version 7.8.0-pre.2 which includes this pull request. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

@remorses
Copy link
Contributor

remorses commented Aug 6, 2025

Is throwing a response in middleware supported?

export const unstable_middleware = [
  ({ request, context }) => {
    // the browser should show plain text, not html with the page
    throw new Response("play text", {
      headers: { "content-type": "text/plain" },
    });
  },
];

Right now I have to implement my own server that wraps react-router for this use case because if you throw a response in a loader it will still render the page #13904.

@brophdawg11
Copy link
Contributor Author

yes - but if you just want a raw response from your loader, why not use a resource route instead?

https://stackblitz.com/edit/github-qyaazmww

@remorses
Copy link
Contributor

remorses commented Aug 7, 2025

Awesome! My use case is to return a plain text response when a catchall route ends with .md extension in a docs website. The route is the same as the page so it cannot be a resource route.

Copy link
Contributor

github-actions bot commented Aug 7, 2025

🤖 Hello there,

We just published version 7.8.0-pre.3 which includes this pull request. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

Copy link
Contributor

github-actions bot commented Aug 7, 2025

🤖 Hello there,

We just published version 7.8.0 which includes this pull request. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

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

Successfully merging this pull request may close these issues.

2 participants