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

[draft] react-router 7 support #471

Closed
wants to merge 2 commits into from
Closed

Conversation

mrstork
Copy link
Contributor

@mrstork mrstork commented Nov 28, 2024

Description

Tested https://github.com/remix-run/react-router-templates/tree/main/default with ntl dev + ntl serve + ntl deploy and they all seem to work well. Edge was not tested.

Notes:

  • There is still work to be done to remove remix references from the react-router-adapter but this is meant to serve as a starting point for us
  • There is an outstanding typescript issue with our plugin not being recognized as a valid vite.Plugin type
image
  • If we want full separation, we will likely need to also add a react-router-runtime as I've done here, however it is worth noting that the following variables are not currently exported from @react-router/server-runtime
    • broadcastDevReady
    • logDevReady
    • UNSAFE_SingleFetchRedirectSymbol
    • UNSAFE_SingleFetchResults
    • UNSAFE_SingleFetchResult
  • Further on separation, we need to decide if react-router
    • At the moment there is a fair amount of code that can be shared, however this may change as react-router continues to be developed. It's not something we can easily predict.
    • Do we want to move the react-router-adapter to its own repository, or keep it here for the time being?

TODO:

  • Test/Build Edge runtime
  • Demos/Fixtures
  • Framework Detection in (build)

Related Tickets & Documents

  • Related Issue #
  • Closes #

QA Instructions, Screenshots, Recordings

Please replace this line with instructions on how to test your changes

For us to review and ship your PR efficiently, please perform the following steps:

  • Open a bug/issue before writing your code 🧑‍💻. This
    ensures we can discuss the changes and get feedback from everyone that should be involved. If you`re fixing a
    typo or something that`s on fire 🔥 (e.g. incident related), you can skip this step.
  • Read the contribution guidelines 📖. This ensures your code follows our style
    guide and passes our tests.
  • Update or add tests (if any source code was changed or added) 🧪
  • Update or add documentation (if features were changed or added) 📝
  • Make sure the status checks below are successful ✅

A picture of a cute animal (not mandatory, but encouraged)

Copy link

netlify bot commented Nov 28, 2024

Deploy Preview for remix-serverless failed. Why did it fail? →

Name Link
🔨 Latest commit e064b62
🔍 Latest deploy log https://app.netlify.com/sites/remix-serverless/deploys/6748d45685e03d000893c9c8

Copy link

netlify bot commented Nov 28, 2024

Deploy Preview for remix-edge ready!

Name Link
🔨 Latest commit e064b62
🔍 Latest deploy log https://app.netlify.com/sites/remix-edge/deploys/6748d456d296f00008439039
😎 Deploy Preview https://deploy-preview-471--remix-edge.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Comment on lines +3 to +5
Copyright (c) Remix Software Inc. 2020-2021
Copyright (c) Shopify Inc. 2022-2023
Copyright (c) Netlify Inc. 2023
Copy link
Contributor Author

@mrstork mrstork Nov 28, 2024

Choose a reason for hiding this comment

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

  • Update License messaging

Comment on lines +6 to +9
<!-- TODO update this with react router template -->
<!-- It is strongly advised to use [the Netlify Remix template](https://github.com/netlify/remix-template) to create a Remix
site for deployment to Netlify. See [Remix on Netlify](https://docs.netlify.com/frameworks/remix/) for more details and
other options. -->
Copy link
Contributor Author

Choose a reason for hiding this comment

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

  • Update with reference to react router template

},
"repository": {
"type": "git",
"url": "https://github.com/netlify/remix-compute",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

  • Decide if we're keeping the react-router adapter in this repository

Comment on lines +56 to +64
// We need to add an extra SSR entrypoint, as we need to compile
// the server entrypoint too. This is because it uses virtual
// modules.
// NOTE: the below is making various assumptions about the React Router Vite plugin's
// implementation details:
// https://github.com/remix-run/remix/blob/cc65962b1a96d1e134336aa9620ef1dad7c5efb1/packages/remix-dev/vite/plugin.ts#L1149-L1168
// TODO(serhalp) Stop making these assumptions or assert them explictly.
// TODO(serhalp) Unless I'm misunderstanding something, we should only need to *replace*
// the default React Router Vite SSR entrypoint, not add an additional one.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

  • We should try to simplify this comment if possible (also applies to the remix-adapter as this was copied over)

const start = Date.now()
console.log(`[${request.method}] ${request.url}`)
try {
const mergedLoadContext = (await getLoadContext?.(request, netlifyContext)) || netlifyContext
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@serhalp - I renamed this to mergedLoadContext, is that reasonable?

@@ -0,0 +1,66 @@
# Changelog
Copy link
Contributor Author

Choose a reason for hiding this comment

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

  • Clear runtime changelog

@@ -0,0 +1,11 @@
# Remix Server Runtime for Netlify
Copy link
Contributor Author

Choose a reason for hiding this comment

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

  • Remix in runtime readme

},
"repository": {
"type": "git",
"url": "git+https://github.com/netlify/remix-compute.git"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

  • Are we keeping the runtime in the remix-compute repository? (repeat)

@mrstork
Copy link
Contributor Author

mrstork commented Dec 11, 2024

Replaced by #472

@mrstork mrstork closed this Dec 11, 2024
@mrstork mrstork deleted the react-router-7-support branch December 11, 2024 02:53
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.

1 participant